I've been thinking about the caste system recently. I don't really understand what kind of societal dynamic would lead to the creation and formalisation of such a thing.
Is it that such divisions were necessary in an economic sense - such that someone needed to clean feces and move dead bodies around, and there needed to be a steady supply of them generation after generation?
Or was it just a bizarre quasi-religious idea that slowly formed itself around ethnic lines over time - with little to no genuine utility?
Any insights would be appreciated.
Indian history is framed around a series of migrations into the Indian subcontinent. Prehistoric India was largely a mashup of tribal populations related to the Australasian aboriginals, some people more associated with prehistoric east asia, and perhaps even some prehistoric near eastern people. The makeup of modern "dravidians", the major ethnic group of South India. At some point, a collection of city states formed around the Indus (but had colonies along the Western Indian coast and as far north as Uzbekistan). We know next to nothing about the people of this civilization, and sadly, modern study is infected with the various strains of Indian nationalism, claiming them to be either the Aryans mentioned in the vedas, or Dravidians of Southern India. Historically, it is impossible for them to have been the Aryans and we really don't have any evidence pointing to them being Dravidians either. So for now, they represent a ghost population in Indian history - perhaps closer to the Elamites and Sumerians but once again, no evidence except circumstantial.
In the classical age, Indo-European migrants "aryans", orginating from somewhere around the Ukrainian steppe, migrated east into Iran and Northern India. They destroyed the Indus river valley civilization, but ended up adopting a settled way of life. This is the time period the first Indian scriptures and epics are based in. These people enslaved much of the existing population or at least relegated them to the lower classes. They, like all Indo-European societies, were highly aristocratic. The problem? Genetics shows that these migrants were almost entirely men. So mixing occured early on in spite of the caste system developing. Being patriarchal and ignorant of genetics, they understood identity to be passed down by the father, so even as the caste system began to crystalize, there was a steady flow of those native genetics upwards into the "Aryan" aristocracy. The tribal people, whom are mostly abbo by genetics, were particularly offensive to this Aryan culture as they would steal cattle, horses, etc from the settled farming population and their Aryan rulers. These would later become the untouchables.
Combined with later changes in Indian religious tradition, especially after the axial age, the caste system became justified through spiritual concepts like karma rather than just a way to maintain the heriditary artistocracy.
So what started as a way for these conquerors to maintain control became a religious mandate, and morphed over time. Combine this with several waves of migration ranging from the Greeks under Alexander, to the dozen or so turkic migrations, and the arrival of Islam - each leaving a footprint in genetics, even among people who never became Muslim, we get the insane mess that is the Hindu Varna system as it exists today.
I've studied Indian history extensively even though I've come to despise modern Indians. I may not be 100% correct with some of the details because its a complicated subject that, in modern times, is heavily slanted towards either various nationalist or socialist filters of interpretation, and its been a long time since I've really dug into the literature.
You may notice parallels to what happened in South America - Think of India as South America in 2000 years, perhaps with worse genetics via the abbo genetic footprint. Christianity may play a role in keeping them a bit more stable too - if they maintain it into the future.
Ultimately, India is a schizophrenic country in terms of philosophy, religion, culture and genetics. The Indian mind is fatalist in orientation and able to compartmentalize even the most horrific sights. They're unable to establish a proper moral code to unify the people as every random "holyman" preaches his own creed.
This is also why Ancient India was a far more advanced, ethical, and functional society than modern India - even though it was a society that was pretty abhorrent for its own reasons.