The various town buildings basically increase the relevant kingdom stats seen in the left side bar on the town build screen. How high those stats are determines when you can level up your advisors, whether you can unlock new advisors. With the locked advisor slots, like the Arcane advisor, locked behind levelling up Divine, and so on for the other locked advisors. Espionage is defo the hardest to unlock, leave this till way way into the game. I believe you have to level Divine up to 60 before you can unlock the Arcane slot, which you need to then build teleporters, plus you do also actually need to do the Advisor upgrade card to actually level the Divine advisor up enough times before the Arcane actually unlocks. This advisor upgrade is just another event card which is one of those which takes a fixed skip time. I had to trawl guides for all this myself, it defo is the hardest bit of the game to understand. The good news is, once you have unlocked all the advisors, then optimal town building is not that important, if it ever actually is for that matter, and you can just bang buildings down without having to worry about optimising stats. That is unless you start losing stats because of failed problem events, which is why you prioritise those. There are guides for optimal building types to get neighbouring bonuses, but as I say, after a while you need really need to bother with that side of it.