If there is one conclusion to be drawn from the rivers of ink expended on regional nationalism, it is that its existence is not to be explained by race, religion or history alone. Nor by sheer economic interests. Elites are the key word; elites which necessarily operate from urban centers, because it is there where culture is created and diffused. Nationalist disputes are waged between cities and their urban elites.
For millennia humanity has lived under kingdoms and empires, always emanating from cities. Cultural homogeneity within the territory was not always a factor. When the Roman empire faded out, it seemed that the cities might be drowned within the rural world, ruled by feudal warlords. But the urban centers survived, their superiority resting on their concentration of resources, compared to the fragmentation of feudalism. However, modern states did not arise first in the most urbanized societies, such as Italy or Flanders, but rather in broader territories dominated by a single town: Paris, London, Madrid.
In 1500 no single town dominated the Iberian peninsula. The richest region, Old Castile, was dominated by a constellation of wool towns. On the Mediterranean were two strong maritime, commercial nuclei, Barcelona and Valencia. Castile prevailed because, after a process of dynastic absorption and conquest, the monarchs established their seat there. Madrid then had very little to recommend itself, except a central position and good hunting in the nearby hills. The monarchical power, allied first with the towns against the feudal lords, and later crushing the urban rebellion, ended with a monopoly of coercive power.
For millennia humanity has lived under kingdoms and empires, always emanating from cities
The Spanish monarchy embarked on a variety of military enterprises which, due to the resources from the American colonies, produced a century of Spanish supremacy in Europe. But its exclusive dependence on military power, to the neglect of industry, weakened and depopulated Castile. In the 18th century, the first Spanish industrialization began around Barcelona, and the elites of that city began to feel nostalgic about the self-government (not independence) they had possessed until 1714. The rivalry with Madrid, whose sole strength was monarchical and military, thus began; and the cult of Catalanism, fostered by the Barcelona elites, grew throughout the 19th century.
A parallel process, with its own variants, was going on in Spain's other industrial hotbed, Bilbao (but not the Basque Country as a whole) which, feeling superior in terms of wealth and connection with England, also challenged Madrid, mounting a cult of Basque-ness as an instrument. In Galicia, too, nationalist feeling arose, but which never attained such strength, for complex reasons - one of these certainly being that there was no dominant city to foster it. Most of the subsequent Galician nationalist ideology emanated from Madrid and Buenos Aires.
Today, a century after that process, the picture has changed. Madrid is no longer a peasant village dominated by a proud palace, but the economic center of the country. However the stereotypes remain, because the nationalist viewpoints mounted by Barcelona and Bilbao have had unquestionable success. Meanwhile, Spain has sought to create a centralized state on the French model, a mistake when there are at least two cities that can rival Madrid. The chief of these is Barcelona, whose political and cultural elites find it increasingly irksome to depend on the capital, and have managed to convince much of the Catalan population that the best thing is separation from Spain.
But in the post-national era, when national sovereignty has lost much of its force, other solutions are possible. One would be a Senate conceived as a chamber of regional representation, possibly situated in some other city than Madrid. Though I fear it is a bit late for that.