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).
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).