This is a bug; Thanks for bringing this to my attention!
Fun fact: the game has a "static analyzer" that marks objects which are guaranteed to not move or change, which lets the game make undo states use less memory. I do wonder if that was a good decision, though, since it often caused bugs (like this one) and doesn't save a whole lot of memory overall.
I do think this is funny, and I found many similar bugs over the course of development. Part of me wants to keep this behavior when "enable old bugs" is turned on, but:
- This causes some potentially dangerous behavior with reading/writing out of bounds (My development builds of the game check for Out Of Bounds reading on many arrays, and this bug causes OOB reads, which are concerning.)
- I could change the code so this bug behaves in a safe way, but I'm thinking that might be a lot of work.
- I could add in those "weird flags" in a safer way in the future. Possibly.
I'll upload a patch that fixes this (and improves/fixes some other things as well) some time in the near future.