Figured it out. Problem was that I was using the text mode editor, which for some reason likes to auto-remove certain formatting tags, like linebreaks, paragraphs, and so on. Entering the code into the Visual editor somehow worked.
I would have thought it would be the other way around, but there you go, in case anyone runs into this problem in the future.
I tried a much simpler line for testing purposes
[php]
echo "Hi, \nHello";
[/php]
Still no go. The output:
Hi, Hello
So something is wrong at the fundamental level, it seems.