The Indian subcontinent was NEVER actually conquered by non-Indian soldiers, all foreign colonization (Sultanate/Mughals/British) was done almost entirely using hired Indian mercenaries, more than the divided native kingdoms could afford
This was because the modern concept of race did not really exist pre 1800s, so for example if you went back in time and told an Indian mercenary that he was a race traitor for conquering Indian land for Persian, Turkic, or European people, he would be confused/indifferent and not really understand or care about what you're saying, unless of course you showed him an iPhone or a bag of chips or something. From his perspective there are already some natives of India who phenotypically look very similar to Persian, Turkic, or European people. From his perspective the people in the neighboring Indian kingdom who look just like him are also "genetically" different from his people (innately/spiritually/in their soul/nature)
He didn't see it as a foreign race conquering his race, and neither did any foreign conquerors at the time. He saw it as his boss paying him for contractor work, and his boss was just one of many in a long line to gain control over the most invaded and contested land in history.
It was only in the 1800s during the height of colonialism when Europeans began creating and socially engineering the modern concept of race, and shortly after Indians began to form their own pan Indian anti British identity and revolted and the British simply could not afford to keep India. Because historically it was never possible to conquer/rule India without using Indian troops.
The only times it was a foreign army conquering, they only held border kingdoms and small pieces of territory, they always failed and were defeated and driven out of the subcontinent when they tried taking on the major Indian powers. The Mongols, Huns, Persians, Arabs, Scythians, Greeks, Dutch, Portuguese, etc all were defeated. India is literally the most invaded land in history due to its fertility wealth and knowledge, maybe only Egypt or the Fertile Crescent faced slightly more foreign invasion. But relatively India is actually one of the least or the least conquered by foreigner lands in history