"... there are Hindu texts that specify a 'caste system'."
"Caste system" is not in scriptures in the way to be followed. Yes there are many mentions of lot many castes as a family lineage. Probably you meant "division system".
For example, lord Krishna, belonged to Warrior/Kshatriya "division"; which exists throughout the world in form of armies, lawyers, politicians, ... However his "caste" was "Yadu" (or "Vrushni") dynasty, which is said to be diminished from its original form nearly 5000 years back.
Must these systems be followed, or is something like a classless society as outlined by Marx (minus the atheism bit) allowed?
Whether to follow "caste system" or to continue "division system" is upto the society. The post independence India was leaned more towards Russian style "Communism" ("Socialism" to be precise) and the "caste system" co-existed with it. In recent times, it's diminishing largely.
"Division system" is not something follow-able, they exist anyhow.
"Divisions" vs "Castes"
Divisions are "descriptions" of a one's spiritual nature which also relates to work he/she does. According to scriptures, there are only 4 types of divisions in a (Vedic) society, no more no less. Since, it's already detailed in this and this answers, let's brief them:
- Brahmana Or Intellectuals: Steadiness, control, austerity, cleanliness, tolerance, sincerity, knowledge, science and faith are certainly Brahma(na)'s natural Karma (BG 18.42)
- Kshatriya Or Warriors: Heroism, brightness, courage, fitness, also not running away from war, generosity and kingship are Kshatr(iya)'s natural Karma (BG 18.43)
- Vaishya Or Businessmen: Farming, cow protection (animal products), business are Vaishya's natural Karma (BG 18.44)
- Shudra Or Servicemen: Services (in all fields) constitute natural Karma for Shudra (BG 18.44)
Castes are "names" of the families which tend to belong in these divisions. There can be several hundreds of castes throughout the world. Certain castes come into being, & certain diminish with time. In today's time they hardly describe any particular division.
In today's time, in 1 caste/family, members belonging to different divisions is possible. One person having attributes of multiple divisions is also possible. The exclusivity is gone.
Above doesn't mean that "castes" never had any relevance with "divisions". In old times, the families belonging to particular divisions will continue marrying within those families only. Due to which births after births, certain "families" (or "castes") would become more & more synonymous with a particular "division". Logically it's true. But in today's time there is hardly much relevance due to hybridization among humans. Even if it's there, then it's hard to prove due to their work nature.
Analogies
(1) "Einstein is a scientist"; is like describing a "division". Whether anyone subscribe to it or not, "scientists" exist.
Now, "daughter of Einstein is also a scientist"; This is called "caste-ism". She can be "scientist" or she cannot be. But instead of deciding it based on her nature of work ("division"), we decide based on her family lineage ("caste").
With the disappearance of surname "Einstein", this caste which supposedly belonged to division of "scientists" will be gone.
(2) "Race" is a "division", while countries are "castes". Predominantly let's assume that there are mainly following races: White, Black, Brown, Yellow. In old times,
- "European countries" belonged to "White"
- "African countries" belonged to "Black"
- "Middle & South-East Asian countries" belonged to "Brown"
- "Far east asian countries" belonged to "Yellow"
If "white"s continue marrying "white"s & "black"s to "black"s in all the countries ("castes"), then the race ("division") will be retained for their children. This is what happened in above continents for centuries in earlier times.
But, if a white & black marry, then they may generate a "white" or "black" or even a "brown" baby. The baby can now belong to either of its parents' race or both or none of them. This is what happened American continents in recent times. i.e. If you see a "black" person in USA, you can't be sure that all his family lineage will be of "black" genes only.
(3) On a lighter note, terming "Hinduism = way of life" is "division", while "Hinduism = religion" is "caste". :-)
"does the religion work with communism."
If atheism is removed from "communism", the religion might work with it. But "divisions" will always exist irrespective of religion (e.g. "Hinduism") or social structure (e.g. "communism").