Environmental hazards that make the city difficult to attack but also encourage the use of undead? Desecrated ground, rampant negative energy (with tomb-tainted soul likely being common between this and the undead presence), hungry undead whose draining abilities are useless against undead legions and who do not automatically attack them, strong thread of necromancy present in sorcery/native abilities, ancient pact for survival of the living against dark forces?
City has been sacked by the forces of light and positive energy in the past, conquered, occupied, and wound up corrupting them through the insidious influence of native magic and native belief, resulting in reformers whose methods grow steadily towards the necromantic while maintaining some idealism unrecognized by the next conqueror? As per Wee Jas, those who live in the city willingly give consent for their body to be used and consider it holy to serve after death, thus discouraging anyone whose motive is that necromancy involves desecration of the dead? Also as per Wee Jas, funeral customs could involve decorating the cleaned bones of skeletons who are raised, recording accomplishments and history and honoring with beauty ...
Perhaps there are some Deathless members of society, able to maintain dominance of force over negative-energy-infused groups while quite able to survive positive energy to preserve culture should a Sunbomb be unleashed.