I can certainly vouch for how building "codes" may or may not work. The prior owners of my historic home took advantage of the Urban Renewal craze of the 1970s (Urban Remuddle is what is should have been called, but that's another story). The work was done through the city on some type of grant that was available then, so the city had to approve all of the contractors, and I would assume that meant the code inspectors would have been involved. And perhaps they were, but man-o-man, what craziness they put in this house. There were a few of those eye-popping out-of-code items (like unjunctioned electrical connections in the attic), but most of the stuff "met code" of the 1970s.
I have spent the past 17 years pulling out all the cracked, bent, warped, twisted, rotting stuff that was installed in the 1970's (in the time of Code Enforcement), and getting back to the good, solid, plumb, square, stable structure of 1901 (in the time before Code Enforcement). I guarantee you, it's only because those original guys OVERBUILT every single blooming thing in this house that it's even still standing today! Everything that Urban Renewal put in was "to code", but didn't quite last 20 years.
It's made me realize that where I have a choice of materials, and one costs $50 and the other $75 because it's slightly better, I'll go with the $75 every time. I know for a fact I won't miss that $25 twenty years from now when I'm admiring the finished project for the umpteenth time and thinking, "Man, this thing sure has withstood the test of time."