Even though many twisted invterpretations are given, caste system is essentially based on birth only. It is built on the basis of Karma Theory: depending on a person's karma in the previous birth he takes birth into respective caste or into animals. Bhagavad Gita never says caste is not based on birth. But the scripture adds the piont that to make his caste dharma perfect, a person should follow cetatin professional duties and qualities. So the Chathur Varna is based on birth only. Why Eklavya was asked to remove his finger. Because he did something, his caste did not prescribe. Otherwise, Eklavya would have been a good ally to Duryodhan. Why karna was often referred to as Sutha even after he became a king. Because he was perceived to be the son of the fisherman who brought him up [the fact that he was the son of Kunti was known only to Krishna].
So caste system from the beginning is based on birth only. Instead of giving twisted answers, let us reform it. Hinduism has many other merits, but system is blot that needs to be removed