As a post-Hindu culture, we used to have the four castes (I think the Balinese still use them for marriages and stuffs), but never as strict as in India. Still, the generation that destroyed it (in the 1600s-1800s) found themselves stuck in another racist-classist caste system of Europeans on the top, "Orientals" on the middle, and natives on the bottom.
The solution to that was inverting the colonial racist system for a while. Fortunately we stopped after only 2-3 generations.
We still don't have perfect equality though - but much better than previously. One can not change his skin, but he can change his wealth level.
Caste comes from the Portuguese word "castas", the caste system is widespread in Europe.
The hierarchy in Europe is
Clergy, Nobility, Landowners, Merchants, Tradesmen, Peasants, People working with sewage, carcasses etc...
The fact that the Church had a monopoly on god gave rise to the rigid hierarchies. The king was the representative of god and was conferred powers through the church.
When the colonialists set foot in India, they were faced with a problem there were too many gods & no central authority. The modern hierarchies and pyramids that you are presented with is an oversimplification and invention of the British to centralize their control.
Many European carry their family profession in their surname, this is often understood as caste in modern India.
Eventually the idea of CRT(critical race theory) is to align the “racism” in west is because of casteism in India.