It may be a mockery but the child is not the one doing the mocking. Would you deny salvation to the child for the actions of the parents?
“The doctrine of the Church also recognizes implicit baptism of desire. This consists in doing the will of God. God knows all men and He knows that amongst Protestants, Muslims, Buddhists and in the whole of humanity there are men of good will. They receive the grace of baptism without knowing it, but in an effective way. In this way they become part of the Church.”
http://outsidethechurchnosalvation.blogspot.com/2009/07/archbishop-lefebvre-on-extra-ecclesiam.html