Does California have it's own Code or does every state use the IBC now? IIRC, there used to be about a half dozen Building Codes in effect in the US depending on the region of the country with the SBC the most common. Some buildings may indeed be grandfathered. When newer codes are adopted, usually they don't enforce building owners to change existing conditions unless they are doing major renovations and changes to the building. An older code, however illogical may have allowed such a primitive condition such as locked stairwells to exist. But any building operator worth his salt would have changed out that lock out function just because it is very unsafe.

In Canada we have a quasi National code - that means that all the provincial jurisdictions have input into writing the code, then the "model code" is created which the provinces are thus able to use by adopting as is or to amend if they wish. My province usually adopts it carte blanche and then amends it with a few minor clauses unlike Ontario which rewrites wholesale several sections. Eventually we will get to a true national code.

I got some feedback from Fire Official involved in writing codes. He said that all North American codes can trace their routes back to certain instances and particular fires that have occurred. I will have to check the dates but for example around 1913 there was a major fire in the US that basically set out revisions for certain exiting requirements from structures and another fire in the '50s that generated another set of major changes (ie fire ratings for doors and enclosures). All other changes have been "minor" revisions but were based on those two extreme events.

In Canada, we've had a number of construction site fires in the last number of years (Google "Edmonton condo fire" - this has led to major changes to the Codes and some provinces did not even want to wait for the next major edition of the Code, they simply added the revisions immediately because this was considered as a very high priority.