You're right, affirmative action here seems to fail in this way since high caste Indian citizens can simply move to America, and I'm not going to pretend I have an answer there off the cuff. Admittedly this is not a problem I think about specifically often.
What is 100% not okay and fixable even without changing anything about the reservation system is the treatment of those abroad that are in lower castes, which is directly argued against by the OP here:
> These upper caste people are not discriminating due to fact that they believe that one caste is superior to another, they are doing it because they are able to sympathise with the plight of other unreserved Indians in India.
Describing the reservation system as a "plight" on upper castes while not sympathizing with the issues the lower castes deal with is literal classism at work within US tech companies that is clear by reading links to and direct comments containing many first hand accounts.
Affirmative is far from perfect when it comes to restorative justice approaches, but an imperfection does not mean all other ethical statements and stances need not apply. Let the upper castes run from India to avoid dealing with the reservation system, sure, that can't be avoided. However, we as a society should absolutely stop the caste system from continuing here.
I don't think this is the best idea, but theoretically US/world tech could also take an affirmative action type stance when it comes to castes and H1B visas in the US. That'd be an interesting theoretical patch solution, but then that just means more Indians would focus somewhere that didn't take this stance. And the end of the day, this needs to be a cultural change within Indians abroad and in India. But this issue being brought to a larger stage in the US is a great start.