Not that I have anything against using out of country programmers, but it's a fact that China does not strongly enforce copyright and does not go out of its way to protect foreign businesses. I don't know about Russia, India, South America, etc, I'd be curious about anybody that's done this sort of thing before. Tim Ferris always talks about it for things like running his support and returns and whatnot.
There are certain restrictions that the Bay Area places on you, like how much money you need to earn, and a particular lifestyle you want to live, in a very specific industry. This is the same as someone going to Houston for Oil, NYC for Finance/Fashion, LA for entertainment, etc. People who live in those places have a particular set of goals - e.g. building big companies (vc or not), doing well on wall street, hitting it big in the movies, etc.
If you don't have those goals, then absolutely - stay where you want to stay. Work remotely. There is a ton of arbitrage in software dev right now, you can make a killing and live in really cheap places. You can literally live like a king. if that is what you want to do.
So it all comes down to your goals, and the Bay Area as a whole is self selecting in that way. If you want to do something more chill in software, that's great. We need more people making money writing code - it's great for the world economy. But you don't need to be in the Bay Area for this (unless you want to).
San Francisco is a place. Engineering talent is available everywhere, though perhaps most places it isn't so much fish jumping onto the line as in the Bay Area.
What about all the nerds who are Polish, Portuguese, and Peruvian and choose to remain local because their spouses, children, and other interests are? They can still code, some of them are definitely brilliant, and they can either work locally or (more likely) remotely.
Starting a "startup" with venture capital might be next to impossible in Peru, for all I know, but a hell of a lot of folks don't want to exit, don't want to dilute their ownership of their product, and frankly like the environs elsewhere.