than what an AI or cheap programmers from places like India or China could do.
People abroad making less money has more to do with the cost of living, different regulations and so on, not necessarily skill. I'm a mid developer with years of professional experience and my salary is shit for US standards, but it allows me to live okayish here, so that's why we put up with it. Immigrants also often face a precarious position (such as a visa status being tied to their work, or prosecution by the authorities, or not being part of a union in an otherwise unionized industry, etc), so them getting paid badly is, again, not always related to skill. I've met Arab doctors who are cab drivers in Europe.