For your second point, the delta of the “higher salary” is important. US ranks the highest in sofware engineer salaries globally, which means for most countries coming to US as a software engineer will mean a much higher increase in salary than within US. If that delta offsets the perceived cost of leaving friends and family behind, they it is rational to take the offer. In other words, non-US candidates need to be hurting much more than US candidates to lose access to friends and family to not take the offer. In fact they already do, they lose access to their culture and their language unless they are from anglosphere. They still take the offers, so the income differential must be more than adequate to make the transition. Additionally, individual cost function of losing access to these things will differ. Many people will actively seek a challenge away from their friends and families to take up new opportunities and experiences. Your friends seems to have not.
Thanks for your detailed response, though. I understand what you're saying more clearly.
For out-of-US hires, Facebook will actually get you a Canadian work visa, and have you work in Canada for the 7 month wait, and potentially for year if you don't get picked in the lottery. The strategy for multiple large firms is to bring non-US workers to Canada first, and then try to move them over to the US, since US immigration law is extraordinarily restrictive compared to most countries.
[1] The company applies for the worker in March of the year, and if the individual is picked in the lottery, they get to start working for them in October.
If they aren’t wage fixing!
I went studied CS in Idaho and know many of my peers took significantly lower paying jobs than they are qualified for so they could remain in the area. I'm certain at least some of them would rather work for larger companies with higher salaries and better benefits (and more prestige), if it didn't mean moving into the BIG CITY and leaving their friends/family behind.
In reality, it's probably a mix of both.