Code fences with ~~~ have been supported in the forum since at least 2017:
However, when replying by email the reply trimmer truncates messages on ~~~ lines, likely mistaking them for delimiters. For example, sending the literal source text
Prose before fenced code.
~~~
Fenced Code
~~~
Prose after fenced code.
results in a post containing just “Prose before fenced code.”. Using a fence of back-ticks works fine.
IIUC discourse uses github.com/discourse/email_reply_trimmer to parse emails. The code here looks like it will consider a line of ~ characters to be a delimiter, and that is used here to remove everything following it.