HeroOfTime
Challenger Approaching!
Thought so. I personally believe they were (for the most part) palaces for the evil demons, monsters, etc. that lived there. Or to house the weapon that it contained. Possibly it was some relic? Like the Goron hammer in OoT. Or, as mentioned by others, it was to lock up the boss it contained.