I think in 1e/2e you didn't really have to worry about the effect of magic on things like towns and castles due to the rarity concept.
If only 1 in a million people even knew the rock to mud spell, the odds are certainly low enough that you can discount the effect of that spell. Same thing goes for fireballs etc.
I don't see how the rarity thing can work (other than the DM just saying it). I think the accessibility of a resource isn't the only factor. It's also it's influence.
AFAICT all it would take is a few people with a spell that renders 10's of thousands of gold pieces worth of expenditure obsolete. So if I'm a king, I'd rather spend 90,000 gp on a search for that one person in my kingdom who can cast rock to mud then deal with the overhead and time required in building and maintaining a castle. And if I'm the one guy in the kingdom that can cast the spell, why not approach the king and say "hey, pay me the costs of 5 castles and I'll join your army".
And this assumes that it's really only 1 in a million people that can cast rock to mud. I think that value doesn't really match the demographics of what PCs actually encounter in the world (IMO - based on a "typical" adventure module). 9th level PCs aren't that rare in people's games, so why would 9th level NPCs be? YMMV but my general experience is that a 9th level campaign doesn't consist of the PCs fighting zillions of low level NPCs. So in a game where the PCs are constantly battling NPCs of sufficient power to cast transmute rock to mud, I think it's a little inconsistent to then argue that these NPCs aren't around when a war starts.
And even if the NPCs are rare - a 9th level PC wizard will suddenly find himself with tremendous power if castles aren't capable of counter-acting his powers.
It also doesn't take into account persons who have a magic item with this power, but can't cast it themselves. Or the possibility of researching a lesser version that would be very useful but lower level (perhaps with less of an area of effect or other restrictions - like a single 10 ft cube).
Which is why I think in 1e/2e the classic medieval town makes sense since spellcasters are rare to begin with and every level after first, the rarity drops in a hurry. (Anyone remember what the 1e DMG had as breakdowns for class and level in a typical 1e/2e world?)
I only remember a later 2e supplement (about how level adventurers, I think) having anything about demographics. IIRC 3e was the first DnD to have demographic guidelines that were somewhat official (or at least in the core rules)
Smetgzer raises the point that much of the source of fires in a typical medieval town are no longer needed (and this is certainly true in Eberron) but most of the 3e worlds didn't understand what the increased appearance of spells and spellcasters did for the world.
There's cooking, warmth, industry (blacksmithing etc.), branding, and a zillion other uses for fire besides light. People in the city are probably burning magical candles for luck, or lit incense for their deities. Or just pleasant light (like they do IRL) And there's arson and fire-based monsters. "Not as" dangerous as IRL doesn't immediately mean to me that fire isn't still a basic issue in fantasy cities. Again, severity would be as much of a consideration as frequency. One summoned salamander, no matter how infrequent, would be a problem if he could run around and destroy the whole city.
An army big enough to take over a city was probably pretty rare, but it didn't stop people from building walls around it. IME people worry about rare stuff.