It's both. If software companies were poorer across the board, without changing the supply/demand ratio, salaries would be lower.
But if the companies were to be become sufficiently poorer, the amount they are able to pay has to come down at some point, and once that happens you've got a reduction in demand. That doesn't necessarily mean firing anyone, demand simply measures desire and ability to pay a given price to attain what is wanted.
What this means is that software companies are closer to the money than other businesses.
What's unique about Silicon Valley is the density of software-minded people willing to adopt products made by their friends. It sets up a "if you build it, they will come" situation. That promotes the early adoption needed to grow into something larger. If you were located in Iowa and your friend group was made up of farmers, they likely won't care about the software you are building, and you'll stall out quickly in trying to find users.
On the flip side, if you are building something that would be of interest to Iowan farmers, you will have a greater chance of success having that farmer friend group than a bunch of Silicon Valley tech bros to share with.