You're confusing cause and effect. The genetics did not emerge from the castes, the castes were an effort to entrench through religion the superior social status of invaders who were a different group with distinct genetics. They were not imposed from within by a faction of a unified group that subsequently diverged.