A lot of denominations don't allow laypersons to baptize, except in emergencies. Like midwives and doctors or etc. But that's their church's law, usually to ensure that baptisms are conducted properly and recorded officially, not some restriction of the sacrament itself.
It's the same with marriage. The spouses marry each other, and that is valid, but if a priest doesn't convene the marriage, they are supposed to have the marriage convalidated at a later date. Like Erika and Charlie recently did. 🥹