My answer to this question is that the behavior seems to be a bug, so the next appropriate step would be for you to file a bug report on GitHub.
Separately, I was trying to let you know that it is possible to format code samples in your posts, and encouraging you to do so, since it makes them much easier to read. Besides the backticks method, there is also GUI button in the post editor you can use to format code blocks, it looks like this: </>