It has been decades since I was in contact with the insides of Cisco's IOS and other stuff. Back then even things like the meaning of the "no" prefix in the command line varied from device to device. And there were hundreds upon hundreds of versions and variations.
There is a lot of asynchronous stuff going on in router code. And in big routers there are a lot of specialized assistance hardware. And a lot of things that are based on experience and seem contrary to good software practice.
(For instance, I once used knowledge of packet arrival patterns to cause me to apologize to D. Knuth because I was going against his advice. But I really made things much faster by doing so.)