When Jesus consecrated the Eucharist at the Last Supper, he consecrated all the Eucharists at all the Masses throughout the world until the end of time. All future consecrations are that consecration, just as all future sacrifices of the Mass are that sacrifice on the Cross. Time and place are no obstacle to God. Time and place are nothing to God.
When Jesus, from Mary’s womb, sanctified John the Baptist, in the womb of Elizabeth, at the Annunciation, He sanctified all the unbaptized prenatals, infants, and young children who die at that young age (not all of them, but all who die without formal baptism). Unbaptized infants who die at that young age are given a non-formal baptism of blood, prior to death, so that they die in the state of grace and will have eternal life.
When Jesus blessed the wedding at Cana, which was the first Sacramental Marriage, he blessed all valid sacramental weddings in the future. The power of the Sacraments is from and of Jesus, through the priest, not from or of the priest as a mere fallen sinner. The priest acts in persona Christi, and so the power of the Sacraments is from Christ.
P.S. Can a valid baptism be performed on a child who is still in the womb? Yes. Denzinger 3356. Response of the Holy Office 21 August 1901. And the water permitted for this use has some type of disinfectant added to it.