Because it's better for Earth's biosphere to mine things like lithium on the moon rather than polluting our biosphere. The North and South pole of the moon also serves as an excellent staging ground to put solar energy collectors that can then transmit continuous concentrated power to Earth.

The moon is dangerous because there's no people and civilization is 5 days away at best but if there was already civilization at the moon you wouldn't think it was dangerous.

On top of that the materials on the moon are already "on the high ground" meaning you don't need to spend a lot of money on propellant to get it into orbit. So building space habitats and delivering them into an appropriate orbit on the moon is a tiny fraction of the fuel needed from Earth. To put this into perspective the Apollo Lunar Module only needed 2.2 Tons of propellant to get the upper part of it back into orbit to meet up with the service module. 2.2 tons of propellant is basically nothing with the scales we are talking about.

On top of that if we could produce the propellant on the moon the costs and logistics and difficulty of all of this drop significantly.

So in short the best possible way to lower the risk, cost, and provide functionality is to establish civilization on the moon and get to the industrial age there as quickly as possible.

We're doing it regardless of what you naysayers will say about it because it's the right thing to do for a thousand different reasons. And we're doing the robot thing too. At the same time.