This is how most countries were formed in the Middle Ages. You either are big enough to defend yourself or become a part of big enough country.
And if they pool money to form an army - how will be the funding determined? Some states will want more defence, some less, some will prefer naval power, some airpower . . .
if those people can't agree on anything to such extent that they want to be entirely separate, how would they agree on anything when they would have even less incentive to cooperate? See how dysfunctional EU seems at times today, and this would be way worse . . .
Especially when you start considering other forms of warfare, like trade. Solving all problems leads right back to something resembling either superstate or close coalition of large states.
Also good luck with making an army from nothing just in time before invasion.
Edit: and you are still ignoring weakness of such states on economic level.
Economics is not a problem in a modern world with a free trade. Small city-states, that embrace free trade, fare well. There is even an possibility, that trade liberalization leads to political disintegration: https://www.nber.org/papers/w6163
Did they now ?
Let's say Russia is having an election and the people in Crimea are allowed to vote. Let's assume the majority of Russians voted for Putin but hardly any of the people in Crimea did. Did Russia suddenly become the legitimate government of Crimea just because 'the people voted for it' ?
I think the first step would be for the people to agree to have an election over who governs them first.
AFAIK Catalonia didn't voluntarily join Spain, they got annexed.