See specifically perhaps the encyclical Rerum novarum (Rights and Duties of Capital and Labor) from 1891:
* https://en.wikipedia.org/wiki/Rerum_novarum
* https://en.wikipedia.org/wiki/Catholic_social_teaching
Various others over the decades.
Even after that shift, the Catholic Church continued to be a fundamentally reactionary force in the realm of social policies, all the way through the second world war.
First, the Church isn't in the business of policy. The Church recognizes the distinction between secular and religious authority, and indeed, it is the origin of that distinction, from which the exaggerated liberal separation of Church and State comes from (you won't find this distinction outside of Christianity, and indeed it makes no sense outside of that context). The Church will advise or comment or respond to policies as a moral authority, but policy as such does not belong to its scope.
Second, Catholic Social Teaching didn't materialize out of thin air. It is a culmination and explicit formulation of millennia of teaching. The industrial, political, and economic upheavals of the modern era are what motivated this explicit formulation.
Third, I wonder what you consider as "reactionary" here. The term itself is an incredibly loaded and condescending progressive term and takes for granted the correctness of the progressive view. The Church has been consistent in its teaching. It does not adapt to what is fashionable or to ideological fallout (even if particular prelates may show signs of doing so).
Proceeds to argue that the Catholic Church is not in the business of policy, when it ran an actual, sizeable _nation state_ all the way to 1870 and in fact was extremely pissy when it was taken from them. And you call me distorting? Lol. They are in the business of policy, they've always been.
Dude, I'm from a city that was directly ruled by popes for centuries. We've dealt with all that rubbish over and over, Gelasius' swords etc etc. The reality is that the institution does what it does in order to survive and maintain as much power and influence as possible, by any means necessary. They will find ways to justify anything and its opposite, because theology is just a literary game.
Rerum novarum was an attempt to maintain power and influence in a situation where their power system was fundamentally challenged (or unmasked, some would say). It remained a niche and largely ignored effort all the way to Council II. For all the effort of some local clergy, most of the real powerbrokers in the Catholic Church still don't give two shits about redistribution and social justice, and never will.
The care for workers was a thing long before Marx. Rerum novarum (¶20) quotes scripture on the topic:
> To defraud any one of wages that are his due is a great crime which cries to the avenging anger of Heaven. "Behold, the hire of the laborers... which by fraud has been kept back by you, crieth; and the cry of them hath entered into the ears of the Lord of Sabaoth."(6)
Jesus himself was a tradesman, often translated as "carpenter":
* https://uscatholic.org/articles/202205/was-jesus-a-carpenter...
Marx's caring for the downtrodden and weak is itself a Christian concept; in contrast, Nietzsche hated weakness and Christianity for its support of those that are (he was not a fan of the Sermon on the Mount).