How many software developers can, in a reasonable timeframe, buy a house in the place they live and support alone a family of four people? Then the truly insane salaries you are talking about are not really that insane.
>Laying off makes sense. Sometimes you hire to backfill roles or for strategic teams. Sometimes an H1b is the correct hire.
Developers are seen by companies as over expensive peons and they have been maneuvering to turn the whole field in an low cost industry. I hope you are younger than 30 to still hold such a naïf worldview.