The Law of Sanctums
Why would anyone bother making a castle if an enemy magic user can fly over the battlements or use a stone shaping spell to collapse the foundation? Or invisibly climb in through a window?
Because there is countermagic that can thwart most hostile magic, and the laws of magic itself lean heavily towards defenders, at least defenders who know know how to use the "Law of Sanctums"
The Law of Sanctums is more accurately called "The Law Metaphysical Essence of Sanctums" but that doesn't roll off the tongue only the most stuck up scroll heads will call it that.
This is part of the "Rule of Sympathetic Resonance" which applies to most magical enchantments. It is easier to enchant something to be better at its core function that it is to enchant something to do something separate from its core function.
For example, it is easier to enchant mobility spells into a pair of shoes than it is to enchant mobility spells into a shield or a hat. Because feet and by extensions shoes are already linked to movement. It's not impossible to enchant a shield to make a warrior run faster, but it is more difficult and costly do so.
Manifestation
When warding magic is cast, the whole warded area will glow brightly but this will subside fairly quickly. An enchanted wall or dwelling does not look normally different to the naked eye than an unenchanted wall or dwelling.
Magical warding is usually the LAST thing added to a castle or a set of walls because magical warding will make using magic in construction difficult to impossible. The same Stone Shape that can tear down an unwarded castle cast also help build up an unwarded castle.
Localization
Casting an ongoing defensive or detection spell on a tent or rope fence, the duration of the magic is roughly double versus what it would be cast on an area of an empty field. Such magic becomes extremely difficult to affect with dispel magic spells.
Casting an ongoing defensive or detection spell on a house or a simple wooden fence will roughly double it again. (x4) Such magic becomes virtually impossible to affect with dispel magic spells.
Casting an ongoing defensive or detection spell on a tower or wooden stockade wall will roughly double it again. (x8) Such magic becomes literally impossible to affect with dispel magic spells.
Casting an ongoing defensive or detection spell on a castle, fortress, or miliaritized city wall will roughly double it again (x16)
There is no difference for casting the spell on a nice tent versus a shabby tent or a well-kept castle versus a half-ruined castle. A caste with gaping holes in it will not keep out invaders but it holds the idea of protection and safety within its walls so it will still magnify defensive magic. This also means you cannot dispel a wall that negates fly spells by knocking down a small section of the wall, even if someone specifically tries to fly over the hole in the wall.
A lot of fortifications are blessed by spell-casters who are not residents. An abjurers can make good coin by warding wealthy nobles' castles and cities. If there isn't a mage or theurgist dwelling in the premesis capable of renewing the magical wards, it is possible to besiege a fortified dwelling until the magic expires...sometimes. If the defenders are acting courageously, this will actually enhance the existing magic increasing the duration of the warding spells.
This means most sieges end up being dominated by non-magical siege tactics though warding does not normally stop spells form being cast at the people involved so it is common to the front line warriors of both sides of a siege buffed with augmentation spells of various kinds.
I really like this take - it's a pretty creative way to handle magic in siege situations.
Thanks, I am still working on the specifics for how this works in my RPG system, but I've advised by multiple people to people to separate out lore articles from my RPG articles, but I talk about this about this in lore terms. My RPG campaign isn't likely to have a major siege anytime soon, but it's long been a thing that you can't use magic over or through city walls. The PCs have to use old fashioned subterfuge and bribery to get past city walls of enemy territories and they were able to trap a flying villain by pinning them against city walls. So fun times.