True. I've also been thinking that a lot of times temples contain sacard artifacts, so another reason why temples could be built with so many traps and puzzles is to keep people from getting those treasures. Only those who can solve the puzzles, and get past the obstacles can get to them, that...
Like Repentence said, I think they were built as places for Link to prove himself, or atleast they were built in the mind of “The hero” having to go through it to grow mentally and physically. I'm not sure if the Gods actually built them, maybe they sent divine visions urging people to build...