The Bitcoin code wasn't that good
The Bitcoin code isn't that good, seriously. If you look back at the earliest versions you can see there is remnants of a poker client in the code.
The bitcoin consensus code and the actual coin code are connected they are not modular. this is known as spaghetti code. If Bitcoin had a modular consensus algorithm then they wouldn't have inflation bugs that are caused by other externalities.