According to Catholic teaching, any Christian can baptize in the event of need, and the baptism is valid if three things are true:
1) Matter (water)
2) Formula (In the name of the Father, the Son, and the Holy Spirit)
3) Intent (the minister of baptism must intend to join the baptized to Christ’s church).
I have seen babies born struggling for life in the delivery room in exactly this way.
I spent many years working in a major hospital's ER and saw many,many memorable things....most of them sad.
Among my most vivid,powerful memories was watching one of our nurses baptize a little baby who was stillborn.It was about 30 years ago but I can see it in my mind like it happened this morning.
You forgot the part about the person being baptized making a conscious decision to do so. A 2-year-old child can do no such thing. I Peter 3:21...