PROBLEM SOLVED! The garbage collector is innocent. When using --os:standalone, you must provide a file panicoverride.nim. I wanted to prettify my output_message, so I imported another module (which contained the asserts etc.) in to panicoverride.
It seems that the panicoverride code is processed somewhere in the middle of compiling stdlib/system, so it's no surprise that parts of the system module itself have not been declared before that point.