There is a better way to make this work
Firstly, to be able to answer this well with a mechanical solution, we would need to know what resources your BBEG has access to — how much gold, what class and caster levels?
But, it is pretty clear that unless this is a town of nomadic huts, making a whole town move around magically in line with game mechanics available to PCs would require an immense amount of resources for anything but epic levels (and maybe even then). Maybe a large number of off-label wishes could work in a way that does not conflict with wealth rules.
Realistically though, spells and magic items are designed for a small party of traveling adventurers, and not a good fit for this, due to the magic item economy. A whole town of Instant Fortresses, construct shelters or home aways would break the bank of wealth by level, at pretty much any level. What would you do if your PCs claimed all these magic items?
One way to avoid this is to create the town transiently with spells every day. But an army of high level wizards to create a town of secure shelters, resplendent mansions and walls of stone would likewise seem to be overkill. And very hard to defeat, if they packed anything in addition to those construction spells.
The real answer to your question is that (as Jason_o_o commented) you do not need to construct this effect mechanically, and you should not. Published adventures are full of magical effects that would be hard to replicate mechanically. You’re the GM. Your BBEG and story is not limited by what is available to PCs. You can just give them a traveling town, no explanation needed how exactly they achieved that, if it is important for your story. And you can decide if the PCs will be able to control that town after they defeat him, or not.
Or, an alternative could be that no magic is needed at all. There are examples in history of armies moving and building settlements on the fly, from the Mongols to the Roman army camps. You could limit the magic items to a few select structures like the big bad’s mansion or castle, and have the rest of the town be a mundane moving town.