Assume your city has a 1 mile radius and you can exploit land within 5 miles of the edge of the city.
If 50% of that land can be exploited at near modern rates (using magic to keep fertility up/grow animals faster/etc), each supporting 3 people for a year, that is 35,000 acres, and can maintain a population of 105,000 people in that city. Which is just ridiculously huge for a pre-modern city.
You might have a ring of watch towers a mile further out than the cultivated land.
You'd herd the animals into shelter during the dangerous night. And the cropland would have to be somehow resistant to being eaten or destroyed; possibly the cropland would be closer to the city, and somewhat defended even at night.
Smaller scale versions of that can work for even tiny settlements. So long as there is some way to have a holdfast that survives the night, a blessed ring of defence around your house that usually keeps the night monsters at bay.
Such smallholds might only work in relatively civilized lands, where the greater beasts don't roam. Nowhere is perfectly safe.
To defend your city, you'd fine a place where the ley lines are sufficient to power the runes and rings of protection, and fertility of the land is high enough. They'd start as small holds, exploiting the ley lines to survive. Over time they'd clear more and more land around them, always at a high price. Satellite holds would open up nearby at good spots and trade with the growing main hold, and eventually be swallowed up.
--
Now, why? I want a world with plenty of ruins and the like, but also with everything from cities down to hamlets and cottages. In the real world when huge cities appeared, there was little in the way of dangerous wilderness anywhere close, and no great beasts usually on the continent!
By forcing the cities to be small and tight, and using fertility-magic as the excuse to generate modern yields, we can have a great metropolis that is not that far from places to adventure.
The danger of this society keeps their population from exploding. Surplus peasants can be used at the dangerous job of clearing new land, from which only a small percentage survive. So you can avoid the "50 peasants for every non-peasant" population; that 100,000 person city doesn't need 5 million peasants covering all of the land to the horizon. Instead, the city has 10,000 farmer and herders, 40% dependents, and 50% tradesmen, priests, soldiers - city dwellers. A real metropolis.
(That is still a much higher percentage of food producers than modern western society has. And as I didn't assume cheap transport, the food production ends up being right near the cities.)
This also means that there is plenty of land for heroes to clear and settle, and that your skill with a blade and spell is as important as your macroeconomic backing to produce a functioning settlement. Which is awesome for D&D adventure hooks.
A more "realistic" clearing situation basically makes such clearing be a capital project funded by some king, where they burn a pile of money and resources to slowly increase their kingdom's wealth over a generation or more. A unit of farmland might have a surplus production of 0.5%-5% of what it cost to feed the animals and humans who cleared it for a year depending on how "lucky" you got (otherwise, it would have been cleared long ago). So now you are talking about investing 100 tonnes of food to get back 1 tonne of food produced per year; as you cannot store food long-term, that is better than letting it rot or letting peasants starve and revolt. But again, that isn't a fun D&D game of conquest!
With the ability to expand settlements limited by valor instead of the effort to clear the land, the PCs are in a great place to become kings.