As stated earlier Pius XI could have been a very different pope. The events of 1848 scarred him personally for life. He might have been more open to change and that could trickle through his successors, if he hadn't been forced to flee Rome.
I suggest he gets extra militairy protection from another country, as a precaution. There had already been a wave of revolutions in 1830, and maybe a sovereign was wise enough this could happen again after the first revolts in 1848. Neighbouring kingdom of two Sicilies is not an option for this, as it was already embroiled into a revolution in Sicily. I was thinking of Spain. Not only did that country remain revolution free, but that country helped in 1849 to quell the revolt in Rome.
I also want to point you toward the interesting case of catholic politics in my own country in the 19th century. The Catholic elites and representatives in the south of the Netherlands, where there is a catholic majority, were around 1848 absolutely not opposed to Liberalism. On the contrary, a coalition with the liberal forces meant an official restoration of the Church Hierarchy as part of the freedom of religion principle. It was only after that goal was achieved in 1853 and the growing demand in catholic circles for catholic education that there was a break with the liberals. When there became an official catholic party at the end of the 19th century, there were stil within this party many differences. You had a reactionary wing and a social wing (heavily influenced by Rerum novarum) and in between the moderates. After WO I this party, RKSP, started to dominate Dutch politics. With some regional exeptions they got near 100 % of the votes in the two provinces in the south and some other catholic areas.