Foremost, Architecture is art and a science, just like how Cartography is. There are ones that go for function, and plausibility, and others go for the outlandish, and artistic (At times - that pockmarked building is just weird.)
And getting an equilibrium is hard, it's easier to make something so useful and solid that it is beautiful, and to make something so beautiful it works, but it's hard to make something that both works, and is beautiful.

Why would elves build in trees? What if there was a lightning storm? What if invaders used flaming arrows and greek-oil to set the trees on fire? What if termites eat the tree's roots away? Is it really worth the building expenses, then, to build up there? If it was then wouldn't we humans have done so more often instead of building on bedrock and stone foundations that don't rot and erode much slower?
Not to throw magic around, but most elves in settings have magic, or don't live in tree houses at all, but rather live in the woods as a hunter gatherer who sleeps in trees without houses. Said magic could enhance the trees, and stop most fires from happening on the tree.

And why would Dwarves build such huge hallways and rooms if they are so much shorter than humans? Why would they limit themselves to building underground when they could more easily get fresher air and access to agricultural bounty above-ground? Hell...what if there was an earthquake? Our friends in the trees and below ground would equally be screwed wouldn't they?
Inferiority complex, they feel small, and so they build big. And why compete in the above ground with a massive crap ton of other races vying for the above lands, when you could have one entrance to an entire underground nation self sustained by mushrooms and underground water? If you add under-dark into the equation, that's also another reason to build in the ground - so you can have access to all the exotic meat, plants, and wonders of that place.
You're also mistaken about earthquakes, people are much safer below the ground during an earthquake (I'm talking about more than just a basement.) people in mines don't feel earthquakes at all, and if they do they're minutely small, and if tree's fell because of earthquakes that easily, there wouldn't be alot of forestry would they? These things are natural, and can handle themselves from disasters - in that way, they make perfect shelters at times.

Speaking of which: why do dungeons have so many traps and secret passages? Who built them with that kind of money to throw around? How did they intend to keep things like that a secret from the hundreds of builders they had on site at the time? How the hell are the orcs inside supposed to get to the bathroom if there's a DC 26 spike trap between their barracks and the john and the doorway to the restroom is guarded with a ruby statue of a gargoyle who demands solutions to riddles? I mean there's fantasy and then there's fantastic crap. Things don't need to be complex and original to be good. Sometimes the simplest solution is truly the best one.
I completely agree with you here - minus traps and secret passages - I don't like dungeons that do that unless they have a good reason. There're secret passages and traps in dungeons in real life, it isn't that far fetched, really. Fantasy might be taking it a bit over what would be considered realistic but it is fantasy. Look at the pyramids for example, they have alot of secret passages and traps, to protect something - their pharaoh. I completely agree about the orcs though, I try to never do that in my dungeons unless I absolutely have to.