The only time I've seen anything like that is in my Mod where in addition to other things everyone gets there UB, the building it replaces, and any prerequisite building in any in there starting capitol. And these building will stay even if the city is captured.
So basically Madrid (for whoever owns it) can not have its defenses lowered below 150% thanks to its Walls, Castle, and Citadel. But the AI from time to time will still try. Usually though they figure out after a turn they can't lower it and go into suicide siege mode.