Well, we're not all like that. The average wage for a developer is far lower in much of Europe or Asia that it is in North America, and in North America it's far lower outside of Silicon Valley.
Most of us won't get $200K a year as a developer regardless of what we do.
As for why people in Silicon Valley are overpaid for this work? Well, I suspect it's partly down to a bunch of factors.
For instance, things like rent are pretty high over there, so someone being paid a normal wage couldn't really afford to live in the area. So any Silicon Valley that can afford to pay its employees high wages will, just so they're not commuting miles into work every day.
Competition is important here too. If your competitors pay high wages, you'll also need to pay them in order to lure in employees. So with many Silicon Valley companies pay hundreds of thousands of dollars a year, their competitors have to follow suit not to lose their entire workforce.
Same with a lot of things like free food, transportation, etc. They know people look for perks when choosing a job, so offer them in order to be overlooked for a company that does.
That said, those things are not uncommon in other industries or companies. Whether a company offers free food, charges you for it or tells you to get it yourself from the local high street depends on the company. The latter is admittedly a tad more common outside of the Valley and US in general though.
And yes, there's likely a bubble aspect here too. Startups in the Valley are often flush with cash and finding it very easy to raise capital. So it almost encourages them to splash out money on things like wages and office perks.
Hope that helps!