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?
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.