Just a thing that I noticed is that the castle/keep is usually placed on the edges of the city. Can you place a function to generate the city around the Castle/keep?
It can also be used to mark a type of building/feature from the city to used as the center of the city, like the Temple or Plaza (to simulate a village that its usually build around a square)