And such labor (especially medieval labor), is typically cheap and plentiful. And the results of their labor are not subject to deletion with a single spell slot (yet).
On the other hand, there are a decent number of construction-useful spells as well (Move earth, fabricate, stoneshape, etc.) that could make such a project considerably less expensive or time-consuming. Seems like we can pretty easily get into a quantum worldbuilding debate here.
The caster certainly could be brought in as a specialist to do the casting, but would first have to:
- Exist, and
- Exist in a world where teleportation happens frequently enough that countermeasures are deemed necessary.
The thing is, then, the kingdom would have to prevent every 5th lvl and above chump spellcaster from getting close enough to spend 6 seconds on a spell..forever. Or regularly bring in the specialist to re-up the casting. (Hell, they could run a pretty decent scam if they just occasionally got in disguise and dispelled it themselves.)
But all this drives setting assumptions. If you have a caster spending their valuable time and spell slots on this, it stands to reason that there is enough other magic in the setting to warrant it (including folks who know how to teleport).
And the point is, in order to prevent PC spellcasters from running roughshod over some of your encounters, you
have to incorporate a level of magic into your setting that can fundamentally change the way it
has to operate. Or you just fudge things repeatedly and hope no one notices.