We typically think of "the state" as a structure that is created to protect the interests of the ruling class, by using (ultimately) "special bodies of armed men, prisons, etc." This is definitely the role that the state plays, I'll assume that part isn't controversial.
This also seems to be a good description of how the state is created - eg. feudalism is overthrown, the feudal state is abolished, and the victorious capitalist class establishes a new and different state to suit their needs. Establishing this new state is a historical process (involving trial and error, perhaps reusing parts of the old state, etc.) but the general pattern holds: the new ruling class creates a new state.
But what about more complex cases? Is it possible to have "bodies of armed men" arise first, and later establish themselves as a ruling class? Surely there must be examples of this, eg. a conquering warband ends up with territory that it now needs to administer, tax, prevent rebellion, etc. Or perhaps failed/partial revolutions where the old state is overthrown, but a new one is not established, so the remnants of the military establish themselves as the new state, and therefore as the new ruling class.
What I'm getting at is that perhaps the state and the ruling class create each other through a dialectical and historically contingent process. Maybe the bourgeois class designing and building a new state for itself, from scratch, is the exception historically (and/or an oversimplification in that case as well.) This would have big implications for how we think about post-revolutionary states.
I'm sure that there must be some existing writing about this - can anyone point me in the right direction here?
I highly recommend you check out On Kings by Marshall Sahlins and David Graeber. Has tons of examples of state formation proceeding from "bodies of armed men." Likewise, Society Against the State: Essays in Political Anthropology by Pierre Clastres goes over Brazilian rainforest tribal structure, and how they rejected coercive state power/a standard ruling class while still having a functioning and complicated society. The Middle Ground: Indians, Empires, and Republics in the Great Lakes Region, 1650-1815 by Richard White uses Society Against the State in examining Algonquin society during the 17th-19th century and has similar conclusions.
Interesting, I appreciate the recommendations. Not exactly what I expected, but I'm not sure what I did expect. Those look like interesting examples to think about.