I agree with you, code should be posted as text for the reasons you mentioned.
In my post I wanted to show the thread status from Visual Studio Code and it seemed reasonable too me in this situation to show it via screenshots.
I finally ended up in posting all in just one screenshots as workaround, which led to less readable text for screen readers.