The caste system was practiced for thousands of years before the Mughals - Fa Hien's travelogues, Xuangzang's travelogues, Megasthenes (the Selecuid Ambassador to the Magadha Empire) wrote a book stating the same.

The Muslims and Christians adopted the caste system - Church priests were buried in different graveyards as compared to the lower caste Christians. 

The word "caste" is a Portuguese/Spanish word, to denote how much European blood the mestizos or mulattos had - more European blood meant higher caste. It is still the main form of discrimination in Latin America.

The British created an even more powerful system of apartheid. There is a reason Apartheid lasted till 1994 in South Africa - it was strongly supported by Europeans. Segregation in the USA lasted till 1965 for the same reason - the European part of the population strongly supported it.