From Pope Pius XI’s encyclical Quas Primas (1925):
History, in fact, tells us that in the course of ages these festivals have been instituted one after another according as the needs or the advantage of the people of Christ seemed to demand: as when they needed strength to face a common danger, when they were attacked by insidious heresies, when they needed to be urged to the pious consideration of some mystery of faith or of some divine blessing. Thus in the earliest days of the Christian era, when the people of Christ were suffering cruel persecution, the cult of the martyrs was begun in order, says St. Augustine, “that the feasts of the martyrs might incite men to martyrdom.”34 The liturgical honors paid to confessors, virgins and widows produced wonderful results in an increased zest for virtue, necessary even in times of peace. But more fruitful still were the feasts instituted in honor of the Blessed Virgin. As a result of these men grew not only in their devotion to the Mother of God as an ever-present advocate, but also in their love of her as a mother bequeathed to them by their Redeemer. Not least among the blessings which have resulted from the public and legitimate honor paid to the Blessed Virgin and the saints is the perfect and perpetual immunity of the Church from error and heresy. We may well admire in this the admirable wisdom of the Providence of God, who, ever bringing good out of evil, has from time to time suffered the faith and piety of men to grow weak, and allowed Catholic truth to be attacked by false doctrines, but always with the result that truth has afterwards shone out with greater splendor, and that men’s faith, aroused from its lethargy, has shown itself more vigorous than before.
The festivals that have been introduced into the liturgy in more recent years have had a similar origin, and have been attended with similar results. When reverence and devotion to the Blessed Sacrament had grown cold, the feast of Corpus Christi was instituted, so that by means of solemn processions and prayer of eight days’ duration, men might be brought once more to render public homage to Christ. So, too, the feast of the Sacred Heart of Jesus was instituted at a time when men were oppressed by the sad and gloomy severity of Jansenism, which had made their hearts grow cold, and shut them out from the love of God and the hope of salvation.
34 Sermo 47 de Sanctis.
— Quas Primas 22-23