I don't see the sense in a city having a building code that contains electrical requirements and at the same time is under the NEC.
An electrician could very well do everything required under the NEC and be in violation of a building code. They either need to have just the NEC for electrical or go by the building code if it contains electrical requirements. Or the requirements need to be the same.
The NEC code is a Building Construction Code meaning if you build a building, this is how we do it.
The housing maintenance code is a post-construction maintenance code for buildings and premises.
And you're right, it does happen where someone applies for a permit, follows every code, gets a CO, and they are immediately in violation of the post-construction maintenance code. Do you run out there, shut them down and write them up? Of course not, but some anal bureaucrat could probably get away with it.