The doctrine of Papal Infalibility, while defined in 1870, it was developed over the medieval centuries and is a basic tenet of Catholicism.
The way dogma works in the Catholic Chruch is not that a doctrine is made up when it is defined but that is something common to the Catholic Fait.
That's why we have medieval representations of the Assumption of Mary, even though the dogma was defined in 1950.
And when pope Gregory VII declares in 1075 in
Dictatus Papae that: "The Roman Church has never erred. Nor will it err, to all eternity--Scripture being witness." he is assuring the Infallibility of the Papal institution, even though Papal Infallibility was defined as a dogma 800 years later.