Genetics yes, but also training (how a person is raised in the family, cultural and educational influences and so on), and then the mystery of free will, all play a part.
Even in the Vedic texts, caste or more correctly, varna, was determined by type of work or action, quality and charater traits rather than merely birth. If a person was born in a brahman family but did not behave or act or have the natural characteristics and qualities of a brahman, he would be called a “brahma bandhu” which means “friend or relative of brahmans”. In fact there are historical references to people who were born in one caste or varna, but became another, due to their qualities and choices.
And imho from reading, various racies or ethnicities often have similar strengths and weaknesses (within their group), of course moderated by the free will thing, again.
brahma bandhu - Hindi for “BINO”.