Poland under Communism used religion as a means to subvert the authorities. As the Communist states were supposed to be atheist, it added a means to defy their rule. Leading opponents of the Polish communists were religious figures, like Stefan WyszyĆski taking a leading role.
This could also be seen in 1966 when Poland celebrated the 1000th anniversary of its conversion to Christianity. As the date is also used to effectively mark the foundation of the Polish state, the authorities played that up while trying to downplay the religious aspect of it. This only ensured that people recognised the religiosity of the date even further, and did so to spite the Communists.
Poland's status as a religious outlier has its roots in the counter-reformation, which prevented the Protestants from ever gaining a strong foothold in the East. During the partitions, religious identity was an important piece of Polish cultural identity that distinguished them from the Protestant Germans and Orthodox Russians (though not the Catholic Austrians).
After WW1 there was a very strong right-wing political faction in the Second Polish Republic. Roman Dmowski, the minister of foreign affairs, was a Catholic and a radical Polish nationalist. He had been absolutely instrumental in restoring Poland's independence, and his vision for the future of Poland was a country of entirely Polish speaking Catholics. His influence was probably the most important factor contributing to the prevalence of ultra-nationalistic tendencies in Polish politics throughout the 20th century.
Then of course you had the 1000th anniversary, which was a big deal at the time, and helped to rejuvenate Polish nationalistic fervor during the post-war period. But arguably the most important factor of all was the election of Pope John Paul II. Words cannot express just how much this man meant to Poland during his 26 years as the Roman Catholic Pontiff. Practically every city and town in the country has a statue or memorial in his honor. He was a massive counterweight to the general decline in religiosity throughout the rest of Northern Europe in the latter half of the 20th century.