It doesn't have anything to do with the Sonic 3 levels being involved or not - vanishingly close to all of the code is running from S&K even in those levels, just some data (graphics, chunk layout) etc. comes from Sonic 3. The easiest place I found to do this was Mushroom Hill, which will still just as happily reset you into S&K. The glitch even works in genuine S&K alone if you enable debug using PAR codes or other methods, minus the final reset into S&K being an interesting event. All it is is RAM corruption of the RAM addresses you mention, and it's entirely an S&K bug (though the same mistaken code probably exists in S3, it will never be called in S3&K). Crashes that don't corrupt RAM will not cause this.
And though it is likely an overflow, there is something peculiar about this situation, because it is guarded against in most object spawning scenarios. Skipping the Icecap 1 boss and keeping the snowflakes active will leak object RAM until the game becomes unplayable, but this corruption and crash won't happen; nor will simply spawning too many monitors to begin with. So they did think program for the object limit... just something here seems to sneak around it.