Its ridiculous, I agree, but its used as a hypothetical to make a point.
The thing is, I remember your hypothetical situation being asked since I was a child. The answer given was always the same, namely, if that person died on his way to be baptized, it was most likely because that person was insincere in their desire to be baptized and God knew it. By taking him early, the ever merciful God saved that person additional suffering.
As a trad child, that was the standard answer from relatives, priests and nuns who were still trads. How did that clear answer full of simple reasoning and faith, ever get flipped over to a BOD?