Didn't previous ecumenical councils teach that unbaptized infants could not enter the beatific vision? Or were these teachings considered fallible?
Previous ecumenical councils did not specifically teach the fate of infants who die before baptism. The First Vatican Council proposed a teaching on a limbo-like state for such infants, but it was never brought to a vote at the council.
A few regional councils addressed original sin and waded into the discussion of infants who die before baptism, but these councils are not infallible.
The Ecumenical Council of Florence (1431-1449) declared that all who die in original sin end up in hell but not in equal punishment with those who died in mortal sin. This would seem to logically include infants who die before baptism. However, we do know that the Church has always accepted that the righteous before Christ (who died in original sin) were able to attain heaven after the Resurrection, so this teaching clearly accepted that God makes exceptions to this rule. While man is bound by sacraments, God is not. Although all who die in original sin descend to hell, it is also entirely possible that God can remove original sin from the souls of those he chooses right before their death.
The Ecumenical Council of Trent (1545-1563) stated that there is no other means of salvation other than baptism for infants. This is true in the same sense as we stated above. There is no other means that we have in this world, but God can act however he chooses.
Even today the Church strongly urges parents to baptize their children as soon as reasonably possible after birth (Code of Canon Law, can. 867 §1; Catechism of the Catholic Church 1261).