Well yes, tribalism was a survival trait why is why conformity is so deeply ingrained in human minds and social organization.
That said, in India caste (varna and jati) correlate with genetic clusters that have maintained for millennia by higher levels of endogamy than, say, Ashkenazi Jews:
“What the data were showing us was that the genetic distinctions among jati groups within India were in many cases real, thanks to the long-standing history of endogamy in the subcontinent. People tend to think of India, with its more than 1.3 billion people, as having a tremendously large population, and indeed many Indians as well as foreigners see it this way. But genetically, this is an incorrect way to view the situation. The Han Chinese are truly a large population. They have been mixing freely for thousands of years. In contrast, there are few if any Indian groups that are demographically very large, and the degree of genetic differentiation among Indian jati groups living side by side in the same village is typically two to three times higher than the genetic differentiation between northern and southern Europeans. The truth is that India is composed of a large number of small populations.”
Excerpt From
Who We Are and How We Got Here, Chapter 6, “The Collision That Formed India”
by David Reich
That said, in India caste (varna and jati) correlate with genetic clusters that have maintained for millennia by higher levels of endogamy than, say, Ashkenazi Jews:
“What the data were showing us was that the genetic distinctions among jati groups within India were in many cases real, thanks to the long-standing history of endogamy in the subcontinent. People tend to think of India, with its more than 1.3 billion people, as having a tremendously large population, and indeed many Indians as well as foreigners see it this way. But genetically, this is an incorrect way to view the situation. The Han Chinese are truly a large population. They have been mixing freely for thousands of years. In contrast, there are few if any Indian groups that are demographically very large, and the degree of genetic differentiation among Indian jati groups living side by side in the same village is typically two to three times higher than the genetic differentiation between northern and southern Europeans. The truth is that India is composed of a large number of small populations.”
Excerpt From Who We Are and How We Got Here, Chapter 6, “The Collision That Formed India” by David Reich