I suspect this is not specific to windmills and instead is a general issue with non-castle stock/warehouses where there is no building of this type whose "attached" (closest) stock is this stock, but when one is actually placed it is placed closer to some other stock and the process repeats.
See if that is the case, or if this is a windmill specific problem.
It should be easy to add a check before building any building if nearest stock == this stock, otherwise don't build
I suspect this is not specific to windmills and instead is a general issue with non-castle stock/warehouses where there is no building of this type whose "attached" (closest) stock is this stock, but when one is actually placed it is placed closer to some other stock and the process repeats.
See if that is the case, or if this is a windmill specific problem.
It should be easy to add a check before building any building if nearest stock == this stock, otherwise don't build