@HopelessDemigod Sigh. Gawd. Yes. I have no words.
Software people are supposed to know about this and expect it. Believe it or not, in 56 years of doing hardware/software I was only ever burned once by a race condition. It resulted from not studying the very fine details of the device. Still, it was my fault.
It was also the worst bug I'd ever tracked down. It was the only time I ever used a logic analyzer to track what was going on. Took me a full week to solve it but I finally did. There's a funny thing I overlooked in the specification of the Motorola MC6818 RTC clock chip. Hahaha.
So yeah... ouch!
Read the specs. Take ALL of it seriously. I didn't.