The easiest way to see if there are requirements is to open the edb (export_descr_building.txt) and take a look. If you are unsure what a certain line does a visit to the mod workshop usually provides the answer.
Let's see, castles, you are most likely talking about the last upgrade level, Citadel.
Code:
citadel castle requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, } and event_counter governor_present 1 and hidden_resource metropolis and building_present_min_level castle_barracks barracks
So what exactly are the requirements?
event_counter governor_present 1 ... you need a govenor in it (love how this was implemented)
hidden_resource metropolis ... the crux of the matter, a resource not visible on the map like the trade resources, defined in descr.regions
building_present_min_level castle_barracks barracks ... on top of that a barrack structure of sufficient development
So castles are limited by event (time), resource and structure.