Actually, when the Portuguese revolted against Spain in 1640, the Catalans did, too.
Obviously, only Portugal won her freedom, but saying that Catalonia wasnt a thing until hundreds of years later is demostrably false.
The question is not wether Catalonia was a thing but
what thing it was. The Catalan nationalist view of History is that Catalonia is a poor bullied nation older than the stones and that 1640 and 1700 were separatist ventures driven by nationalist fervor or something.
This last part is demonstrably false by just looking at what the Catalans did in those years. In 1640 the Generalitat stripped Philip IV ofhis title as Count of Barcelona (and thus kingship in Catalonia)
and offered it to Louis XIII of France. When Louis made no secret that he did expect nothing of Catalonia but total integration with France and that this would mean less for the Generalitat than it had with Spain (beginning with, likely, its outright dissolution) the Generalitat switched sides and went with Spain, but at this point it was too late and Spain had to concede the Roussillon to France. This only makes more ridiculous the claims from radical Catalan nationalists that the loss of 'Catalonia Nord' was a conspiracy planned by Spain from the get go to shit over the Catalans for no reason. I kid you not but I've seen people saying that. Because everyone knows that countries have vendettas against their own people and prefer to make themselves smaller on the map in order to spite them.
In 1700 Catalonia was one of several (and I remark several) regions in the Spanish Empire that recognized the Austrian candidate as king of Spain and heir to Charles II in the whole of Spain, including Catalonia. No doubt, the memory of what the Bourbon had tried to do in 1640 played a part. But there was no attempt to proclaim a local king or prince of Catalonia, like Portugal did in 1640, or a republic like Naples did in 1647.
There was a belief, for which the Generalitat was often at odds with the kings of Aragon and later Spain, that kings had to be recognized by the Generalitat and as a result, at any point the Generalitat could strip the king of rulership over Catalonia and
give it to other king. The Generalitat had tried that same thing in 1462, when John II of Aragon was stripped of the title and then offered to Henry IV of Castile, who declined it outright.