One thing to note is that the caste system is not a very politically smart way to structure a society. Rather than developing nationalistic tendencies, people tend to develop loyalty to their caste alone and see the ruler as just another member of a higher caste to be avoided and exploited. Perhaps this was one of Gandhi's reasons for trying to do away with the notion of Untouchables (besides human compassion, which was, I'm sure, a leading reason): he wanted to establish more unity in the Indian state in order to fight the British.