"It's used for ritual/religious purposes" is an archaeologist's polite way of saying "we don't know what it's for, but it was probably central to the rulers of society".
The strict functional differentiation of society into subfields such as politics, education, science, law etc that characterises modernity, emerged only over the last couple of centuries. In the past they were really much more intermeshed. What we mean by religion today has relatively little relevant to ancient societies.
Weren't castes or other social segments strongly associated with certain roles actually fairly strongly established? E.g., "merchant / trader caste", "workman" (with numerous sub-classes: farmer, shephard, woodsman, miner, drover, labourer), artisan", "maid/servant", soldier", priest", ruler/leader"? Also often sage / teacher, and storyteller / musician.
Not the stratification of professional roles we see today (which is pretty staggering) still breaks down not too far from these categories. The US BLS EEO-1 Job Classification Guide's top level breaks down to the following major classifications, each with the indicated number of subclassifications:
I've looked further into how labour has been classified over the past 200 years or so. Particularly interesting is that the US Census Occupation Codes hit their high-water mark (in terms of number of classifications) not recently, but in 1920.
From Integrated Public use Microdata Series, classifications by year:
I'm not 100% sure what your question is, maybe you can clarify?
The evolution of society from the stone ages to modernity is characterised by increasing:
1. Functional differentiation. That means we specialise more in smaller and smaller fields. Even 100 years ago westerners would typically have grown some of their food themselves, and might have played a role in building their own homes.
2. Voluntarism. That means that we choose our field of work ourselves. In the past our social station made that decision for us. If our father was a farmer, we'd probably be a farmer too, if daddy was a slave we'd be slaves etc. Nowadays we progress through a sequence of choices (which university to go to, which field to study, what company to work for etc) and a sequence of exams and tests that seeks to quantify our ability for a chosen job.
Weren't castes or other social segments strongly associated with certain roles actually fairly strongly established?
Sure, and castes, medieval guilds, and the like were stations in society's progression towards modernity.
I'm addressing two points. First that differentiation existed in the past. Though with the dependence on both ag and human muscle power, the size of the nonfatm, nonlaboyr workforce was likely far smaller. But also that those roles had a strong persistence trend within families? -- if your father worked in a field (and it was generally only men who had careers), then you were likely to follow a similar path. How much of that was socially determined and how much based on psychological and other heritable traits I don't know. Gregory Clark's book, The Son Also Rises looks at family status trends in Europe, which is related but not the same though has similarities.
The classifications I posted above show that how specialized you see work depends much on how the classifications are defined. My sense is that periods of rapid change in employment structure lead to increases in classifications. E.g., the 1920 set. Which actually covered 1900 - 1920. See Vaclav Smil's recent articles on the innovation of the 1880s.
I didn't want to convey the impression
that social differentiation isn't a binary, either/or
process. Differentiation has been going on for millenia with some setbacks along the way.
The strict functional differentiation of society into subfields such as politics, education, science, law etc that characterises modernity, emerged only over the last couple of centuries. In the past they were really much more intermeshed. What we mean by religion today has relatively little relevant to ancient societies.