Because there typically is a cost/price function in this. If the cost of living isn't as high, then the company can sell more by reducing the price. To reduce the price they have to reduce the cost inputs. The risk for them, is somebody else working out the same brain awesome can be found cheaper, and removing the market under their feet.
I work in IT, and I know it would suck to be told "you're worth less because you pay less rent" but this actually is normal: The majors are already telling SF residents "take $10,000 to move to Austin but we pay you less" And the majors are already saying "stay in India and we'll hire you and pay you less" -So it is not like there isn't already real world downward pressure on pay.
(the context here is that I am paid way above local average for Australia and way below FAANG in the US, working in a not for profit)
I strongly believe in unions. Even with a union, pay isn't going to be uniform across a nation, or between nations to do the same role.
Musk is making Tesla in the US, Germany and China. I ask, non-rhetorically, which country do you think will wind up in the long term making more of the cars, and why? And, also non-rhetorically, why do you think "knowledge work" (which is what software is) is any different?