The whole "lots of intelligent races so that it's OK to kill non-humans instead of humans" argument never quite works for me. To me, having different races requires magic or something indistinguishable from it.

Why would elfies live in the treeses? Perhaps they share in the life energy of the trees. Perhaps the secretions of the trees enable their breeding behaviors. Perhaps they simply like the sounds of the leaves. Is it more efficient for them to have a different lifestyle? Maybe. There may be whole groups of elfies out there that are house-living, dirt-grubbing critters distinguishable from other races only by the very thin veneer of pointy ears.

Why woould a dwarf live underground? It's usually associated with their creation myths. It's where they feel comfortable. Maybe they do like open spaces, but the sight of the sun and stars terrifies them at a level few can tolerate. Maybe tall galleries are much, much easier to ventilate due to the use of convection to move air around but without having to feel the breeze.

I do agree that most dungeons seem to be just a random collection of things stuck together. More precisely, they are a collection of elements strung together to provide the PCs with a challenge first and foremost, and any other elements are secondary. Very few dungeons have good ventilation, a good food and water supply for all of the inhabitants, and a good sewage system. But most people don't care because it's irrelevant to the problem they're trying to solve (have a good time). Fantastic races and unrealistic settings are the norm because they don't want to role-play the exciting "shuffle the cards, deal out hands, and try to put together matching sets of colors" game over and over and over and over and over and over and over.

My experience is that a whole lot of folks don't prefer to be running or playing with a clockwork simulation. Those folks that do, well we usually call them "engineers."