As explained in this meta.se FAQ post:
Stack Exchange does not have its own syntax highlighting engine. It uses Google Code Prettify. Therefore, any bugs and feature requests regarding syntax highlighting cannot be handled by Stack Exchange and should be directed to the team behind Google Code Prettify. In fact, as pointed out by the OP, there is already an open issue about this.
So, unless the SE folks want to get actively involved in the code-prettify project, I doubt they will fix it. The good news is that this is an open source project hosted on github so anyone else who wants to could give it a go and fix it.
Note that in the example you show above, you can get it to work as expected if you quote your variables correctly. Yet another reason to always quote your variables in shell scripts: