Last week, the Catalan parliament outlawed homophobia, imposing tough criminal penalties for hate speech and hate crime against lesbians and gay men. MPs in the regional chamber burst into applause – but it was about more than celebration: the cheers were aimed squarely at the conservative politicians who run the government in Madrid.

It was Barcelona’s latest gesture of defiance against Spain’s central government, but not the biggest. That will come on Sunday 9 November, when Catalonia’s government intends to stage an independence referendum. Though the Spanish supreme court has suspended preparations for the vote, and the Spanish government says it is illegal, unofficial preparations have continued across Catalonia.

As with Scotland, this is now about more than nationalism: small-country independence movements are being fuelled by the failure of big states to resolve the economic crisis. Where national politics are locked into a tight consensus around austerity – and where the old socialist parties look directionless – it is rational for resistance to flow through channels of separatism and autonomy.

If you take a 50-year view of capitalism, as the OECD did in July, there is a doom scenario for developed countries that goes like this: their populations grow old, placing massive strain on public spending; inequality rises, leading to an erosion of the tax base; ultimately, they go bust, probably facing an energy supply crisis along the way. The ones that do not go bust become ugly, poor and intolerant places.

There are two strategies that could offset this, but big, crisis-ridden countries will find them hard to do. First, says the OECD and many dispassionate macroeconomists, you need mass inward migration to rebalance the population between taxpayers and service users. Second, you need high productivity growth, which probably means a programme of state-directed innovation, which ideally solves the energy problem along the way.

Once you pose the long-term problems of capitalism starkly, the economic rationale for small-country separation becomes clearer. It is not just that big states are unwieldy. Old developed countries such as Britain and Spain have political elites aligned with economic interests that do not favour state-funded innovation, high immigration or sustainable energy.

In this context, if the population of a small country within a larger entity suspects it is going to be the perpetual loser from a 50-year period of austerity, it is logical for them to seek independence. In both Scotland and Catalonia, I’ve sensed a conviction that, if the future does involve inward migration, they would be happier in their skins managing that in a small country with high social cohesion, than a large one that is a mess.

But in the coming bust-up between Madrid and Barcelona, there are crucial differences with Scotland. Unlike Scotland, Catalonia is a big net contributor of taxes to the centre: in an average year, 8% of the region’s GDP flows in taxes to the rest of Spain, costing Catalans an estimated €2,055 (£1,610) each in 2011 (central government does not regularly publish the figures). Now, in a move described as “incendiary” in the national press, Spain’s national budget for 2015 has given Catalonia the lowest settlement for public investment in 17 years.

Facebook Twitter Pinterest Catalans celebrate the 300th Catalan National Day in Barcelona. Photograph: Alamy

So if secession became a reality, and Catalonia ended up using the euro unofficially for a while, neither the ECB or the Spanish treasury would have much fiscal clout over Barcelona. In any case, the ruling Catalan nationalist party, the centre-right CiU, has made big spending cuts since the 2008 crisis. Catalans call themselves “the Germany of Spain” and are confident the new country could pay its way.

The second big difference is the left. Scotland’s radical left made a big impact on the referendum campaign but its presence in Holyrood consists of just two Green MSPs. The Catalan left is much bigger and on a roll.

In 2012, the Republican Left of Catalonia (ERC) surged in elections to the region’s parliament, becoming the second largest party, with 13%. Since May, all opinion polls put the party at about 23%, on target to win the next election. The ERC actually ruled Catalonia in the run-up to the Spanish civil war and – though its policies are basically left-social democratic – it is pushing hard for a confrontation with Madrid, by staging the referendum using the regional civil service, even if it is declared unlawful.

The left has been boosted not just by the years of economic crisis, but by a corruption scandal that has hit the CiU. Veteran CiU politician Jordi Pujol admitted keeping a vast fortune in undeclared offshore accounts. Though he denies it was corruptly earned, that is the allegation from Madrid and in any case it is still tax evasion. Meanwhile, two of his sons – one who has just resigned as a prominent member of the current party leadership – are also facing investigations relating to offshore bank accounts.

Though there are no convictions, and the Pujols claim it is all a fabrication staged by Madrid, among the feisty masses of Catalonia it has pushed more secessionists towards the ERC.

The referendum – if it happens – will be non-binding. In addition, there are two questions: do you want to be a state, and do you want to be independent? So there’s a fair amount of political theatre going on here. But once you inject a left-right element into a constitutional crisis in Spain, the risks of actual social conflict rise.

Scotland and Catalonia are straws in the wind for the whole of Europe. Next Thursday, we get the latest eurozone growth figures, which are likely to show yet another quarter of stagnation or slow growth. Economists will rail at Brussels and the ECB, for failing to make Europe more like Britain and the US. But the political momentum against free-market reform is growing.

In France, you have the far right on 25%. In Germany last month, the anti-euro Alliance for Germany (AfD) party surged to double digits in two regional elections. The Greek government – the original canary in the coalmine for the whole crisis – is struggling to finish its term of office, while Europe’s biggest Marxist party waits in the wings, having won the European elections there and taken control of the biggest administrative region.

There are big forces now in Europe that reject the status quo. If status-quo politicians control all the levers of power, that simply means the opposition will go on breaking out in unpredictable ways, with some nationalisms becoming leftist and some far-right parties promoting the welfare state

With a globalised bond market, only a few massive countries have true control over their tax-and-spend policies. But the lure of secession, of exit strategies from the euro or even the EU, remains strong for a reason.

For the developed world to regain its dynamism, something drastic needs to happen. If we believe the OECD, and other reputable commentators, then radical mindset changes on investment, migration, public-service provision and innovation need to happen.

In Catalonia and Scotland, large parts of the population would rather manage that situation free of a central state that they no longer trust.