If Protestantism favored secular power over religious authority, why did the Habsburgs, the Valois, and other secular ruling families hold on to Catholicism? Was it a matter of faith?
One reason was that a number of these Catholic "secular" kingdoms actually derived a lot of their power from the Church. Two of these were Spain and the Holy Roman Empire.
Ferdinand and Isabella of Spain (and some of their descendants) were (in)famous for the Inquisition. They were also known as "their most Catholic majesties." Because Spain had been divided, they derived a lot of their clout from the support of the church, against e.g the Muslim occupiers of Granada.
The Holy Roman Emperor was elected by seven magnates, three of whom were Archbishops. Most of the Holy Roman Emperors came from Austria. Because the Holy Roman Empire was actually larger than their "Austrian" holdings, these Austrian Emperors tended to be very loyal to the Church. And even certain members of the Holy Roman Empire relied heavily on the tithes and rents that could be collected through the Church.
The French kings remained Catholic because it was important to the French people. In fact, Henry of Navarre (King Henri IV), converted from Protestantsim to Catholicism to win them over: "Paris is worth a mass."
Protestantism was the refuge of kings such as those of England, Denmark, and Sweden who wanted to defy the Church. These were the ones for whom the promise of secular power outweighed the prospect of support from the Church.
A somewhat blunt analysis, but Catholicism was hierarchical and prescriptive, Protestantism more personal and individual - the Bible etc in the vernacular. Kings were appointed by God. To oppose the king was to oppose God Himself - a pretty powerful argument! Cf the English Revolution 1688 when James II tried to claim the Divine Right of Kings'. Who is going to argue with God's chosen, anointed monarch?
During the time of the Reformation there were only a few kingdoms in Catholic Europe except for a few dozen kingdoms in Ireland that aren't usually considered.
1) Kingdom of Scotland - turned Protestant.
2) Kingdom of England - turned Protestant.
3) (English) Kingdom of Ireland - turned Protestant.
4) Kingdom of France - remained Catholic.
5) Kingdom of Navarre - turned Protestant 1560.
6) Kingdom of Portugal - remained Catholic.
7) Kingdom of Castile and associated kingdoms - remained Catholic.
8) Kingdom of Aragon and associated kingdoms including Sicily, Sicily, and Sardinia - remained Catholic.
9) Kingdom of Norway - turned Protestant.
10) Kingdom of Sweden - turned Protestant.
11) Kingdom of Denmark - turned Protestant.
12) Kingdom of Poland - remained Catholic.
13) Kingdom of Hungary - remained Catholic.
14) Kingdom of Bohemia - already mostly (Hussite) Protestant, reconverted to Catholicism after 1620.
Not counting Bohemia the score is seven protestant and 6 Catholic. Furthermore the Habsburg dynasty ruled the Castilian and Aragonese groups of kingdoms and Hungary and Bohemia, making about only four royal dynasties that remained Catholic. Without the Habsburgs most of Europe might have turned protestant instead of merely Britain, Scandinavia, and northern Germany.
Possibly the royal dynasties that remained Catholic did so because they thought that enriching themselves and their nobles by confiscating church lands was stealing.