A lot of AI behavior is hardcoded and thus invisible to the player. This means things like spouse selection, whether they will build or go to war and so on. For your purposes there are a few things that you CAN look at that can help you deal with the AI.
The first is the concept of AI stats. If you open the console (type the tilde or ~ key) then type in charinfo you will get more info about everything in game, from characters to provinces and more. There are a number of AI stats, being Rationality, Zeal, Greed, honor, and Ambition, these are weights applied internally to determine AI character's decision making.
Another thing you can do is open any of the files in the subfolder /common/buildings, this is where details of all buildings for all holding types in the game sit, including ai_creation_factor which determines how likely the AI is to build that particular building once they have determined to build something.