If quality developers could be hired for $2 per hour, that would be fantastic. Imagine how much progress we could make. The first thing I would do is hire a bunch of people to fix the bugs in my favorite open source software.
In the short term it might make my life harder as I would probably lose my high paying development job. But that's absolutely not a good reason to oppose progress.
But you can't escape that gap so long as you're fundamentally trading time for money.
If you want to capture more of the value of your work, you become a contractor and bid firm-fixed or cost-plus contracts instead of labor-hour or time-and-materials.
If you want to capture even more value than that, you work on building business systems and selling a valuable product or service rather than spending your work hours doing the tasks themselves.
Whether you're in Kenya or the US and whether you're doing undesirable or highly desirable work, it is not a moral failing of the business you are working for that they did not also take the time to ensure that you could have become a contractor if you wanted to or that they did not ensure that your economic situation allows sufficient market opportunities for you to quit and form a business if you wanted to.
Developer salaries even in such countries tend to be far better than $2/h, but that's explicitly because western companies like these "were hiring developers there instead", if they weren't, the developer salaries there would match the local market and be even lower.