What factors contributed to this idea?
Effectively, the 17th century was the start of the French and English centralization and affirmation of State power. I will speak of France and my good friend /u/itsalrightwithme will be best to handle Spain in the 17th century and before.
For France, the 17th century is defining. First Cardinal Richelieu was a major political decider that pulled France to fight the Habsburgs in Spain and the Netherlands during a time of Habsburg weakness during the 30 Years War, culminating in a French victory with French Flanders and Northern Catalonia going to France and effectively ending Spanish power on the Continent.
However, the Fronde would be the defining moment of French State power. The Fronde was a "civil war" with thé French Parlement (a somewhat political body thats more or à High court) and a second "civil war" with the nobility. The entirety of this was more of a war against the King for restoration of noble privileges lost during the Hundred Years War and since. However, the a King prevails and ensures that such a thing will not happen through centralization of power and culture in the Kings court. The nobility would move to Paris then Versailles in order to play a role and plead with the King to have a role. Further, Louis XIV has the nobility involved in government, serving offices where they work for the State, this causing them to be invested in the survival and longevity of the State.
In short, Louis focused France to work for France.
Adding on to what /u/DonaldFDraper has written, and I hope people don't mind me contributing here.
The 17th Century for England was characterized by approximately 75 years of tensions between Parliament and the Monarchy.
Charles I (reigning from mid 1620s), although Anglican, was married to a Bourbon princess (Catholic) and had displayed policies of being sensitive to the Catholic cause. This resulted in a distrust of his policies in Britain, which was majority Protestant at this time. Additionally, he was forwarding policies which Parliament considered tyrannical, for example the levying of taxes without Parliamentary consent. This culminated in the English Civil War where the Parliamentarians (Roundheads) faced off against the Royalists (Cavaliers), and resulted in a period of Parliamentary rule, which evolved into a protectorate under Sir Oliver Cromwell. Once he died, his son, Richard Cromwell took over, but was deposed and replaced with Charles II soon after, as the former was considered weak by the New Model Army, the Army that helped Oliver Cromwell establish control over Britain.
This established a precedence that the monarch could not rule without the consent of Parliament, and this became further entrenched when Parliament deposed James II in 1687 and installed King William of Orange, and Queen Mary as the rulers of Britain during the Glorious Revolution of 1688, whilst passing the English Bill of Rights.
This applies if you are looking at it from a Constitutionalism vs Absolutism perspective.
Another important aspect of this century is the Treaty of Westphalia, which applies more directly to nation states. The Treaty of Westphalia concluded the Eighty or the Thirty Years War which was characterized by the Holy Roman Empire's efforts to impose religious uniformity in its constituent states. To conclude the war, the Treaty of Westphalia, which had 109 delegations negotiating a resolution, established that the majority of HRE constituent states would be able to determine policies within their borders, which gave rise to the idea of sovereignty, territorial integrity, and self determination. These three notions underpin the definition of nation states as we understand it in international law.
When it comes to 17th century Europe, Spain faced the unique challenge that the hegemony which it had been endowed with was challenged everywhere. I've written here about the beginning of the Spanish empire and the challenges she faced. It was very much a composite monarchy under which each piece had its own set of rules, interests, and ways of doing things. We can consider the modern notion of a nation-state. What should such a nation-state have? It should have central government, means for sharing resources, an administration, revenue generation, etc.
Well, in the 16th-17th centuries, Spain had to develop pieces of those, but not in ways we think of nation-states today. There were four major components to Spain: the peninsula itself, Italian holdings, the Low Countries, and the Americas (which for simplicity I include the Philippines due to its administration).
On the Spanish peninsula side, difficulties of how to run a large empire were largely ignored due to Castile's dominance and the weak Catilian Cortes following the failure of Castile nationalist Revolt of the Comuneros in the 1520s. Aragon was largely poor and underpopulated, and Navarre had a mix of strong central control and lack of resources so it was largely ignored. Basically, among the crowns of Spain, Castile ruled supreme and on her back carried the weight of the empire, and Castile itself was subservient to the King.
In terms of taxation, Spain had perhaps the most sophisticated system at the time, including the very valuable cruzada tax, ostensibly to enable the running of a Crusades, which brought income at similar levels to the riches of the Americas. It had a national police force the Santa Hermandad. The Spanish Inquisition was also a national organization and highly standardized. Of course, it had controlled the appointment of cardinals and archbishops, too. So, Spain had the beginnings of modern state apparatii.
In the Italian theater, the states such as Naples & Sicily, and Milan, were happy to be part of Spain's empire as Spain provided security to them. The period of Spanish rule was said to have provided the only period of stability following the fall of the Roman empire. And it was a prosperous time too, as Italy's peasants sold food and goods to Spain's various entities and Italy's nobility participated as enterprisers.
In the Low Countries things were very different, as the ungainly assortment of duchies, counties, principalities, all had their own interest and in the end they rebelled against their foreign King. This was a huge challenge for the Spanish, who wanted to keep the region as much as possible and to use it as a plaza de armas against other threats such as France, England, and Protestant states of Germany. In the end, there was little alignment between the interests of the local rulers and that of Philip II, and the Dutch rebellion began which led to the Eighty Years' War.
By the time of Philip IV in the 1600s, it was realized that a more rational, comprehensive system of governing his various entities was needed. Castile was exhausted both in terms of manpower and economy. So plans were drawn by his favorite the Count-Duke of Olivares up to built a national system of army, into which different constituent states had to contribute a fair share of men and money. This led to rebellion in Catalonia and in Portugal. that fragmented the peninsula and led to Portugal's successful restoration. It could be argued that it was too late, that such a system should have been put in place sooner, but by this time the Eighty Years' War was nearing closure, as was the Thirty Years' War with the negotiations in Westphalia.
As I wrote here, Westphalia was a useful milestone for thinking about what it means to be a nation-state. It outlined the limits of influence between state and church, and how states were to relate to each other. So this can be seen as a new way of inter-state relationships.
Going back to how the apparatus of a state was to be formed, in addition to the above mentioned issues between members of a composite state, it is important to see how within each member state, there has to be a new alignment between the pillars of power: royalty, nobility, clergy, and lastly the people. A very good study of this was done by the late Jan Glete, who among his work compared "state formation" in Spain, France, and the Dutch Republic of that era.
/u/DonaldFDraper alluded to Louis XIV's "reform" which addressed this. In the period that it happened in France, Spain had a major regime change from the Habsburgs to the Bourbons, which actually facilitated some of the needed changes.
Bourbon Philip V was able to finally abolish several of the disparage states of Spain and further centralize power. Navarra, being an early supporter, was rewarded and was allowed to keep its fueros in name such that it had a degree of autonomy.
Within a few generations, the degree of centralization of Spain had exceeded that of France. Charles III ruled as an absolute king. And with that, we have entered the 18th century and went over the scope of this question.
In short, I argue that Spain had the beginnings of a nation-state system. However, the challenges of the 17th century, and Spain's decline, led to failed attempts at further centralization under Philip IV; it had to wait for a major regime change to continue.