There is nothing preventing you from praying for anything you'd like, of course; it seems that your question isn't so much "Can we do this?" as "Does it do any good—can it change the past?" And in this case, the standard Catholic answer is "No, unfortunately it can't."
Aquinas addresses the question in the Summa Theologica, First Part, Question 25, Article 4, titled "Whether God can make the past not to have been?" He considers the possibility, for example, that since God certainly had the power in the past to do or to prevent something, it seems that he should retain that power into the present:
What God could do, He can do now, since His power is not lessened. But God could have effected, before Socrates ran, that he should not run. Therefore, when he has run, God could effect that he did not run.
The difficulty Aquinas finds with this is essentially that it would make true the statement that "Socrates did run [since God had to do something about it after the fact] and Socrates did not run [since God prevented it after the fact]." But this is a contradiction:
That the past should not have been implies a contradiction. For as it implies a contradiction to say that Socrates is sitting, and is not sitting, so does it to say that he sat, and did not sit. But to say that he did sit is to say that it happened in the past. To say that he did not sit, is to say that it did not happen. Whence, that the past should not have been, does not come under the scope of divine power.
In other words, anything God could have made to not happen in the past would have to have both happened (so that God had something to prevent) and not happened (because God prevented it). Aquinas believes that contradictions like this are impossible: not because it is a limitation on God's power, but simply because logically impossible things are (by that very fact) not something we can reason logically about:
[A logically impossible event] cannot come under the divine omnipotence, not because of any defect in the power of God, but because it has not the nature of a feasible or possible thing. Therefore, everything that does not imply a contradiction in terms, is numbered amongst those possible things, in respect of which God is called omnipotent: whereas whatever implies contradiction does not come within the scope of divine omnipotence, because it cannot have the aspect of possibility.
(First Part, Question 25, Article 3)
Certainly if God cannot be said to be capable of changing the past, we cannot successfully pray to Him to do it.
As far as your examples, if a child has died without baptism, we certainly commend the child to God in the hope that they will be saved in a way unknown to us; but we cannot go back and get the child baptized. This is a sad thing, sadder than the death of the child perhaps; but it does not prevent God from working in the life of the mother, and this may be the best that can be hoped for.
Similarly, if a relative dies and you believe they are in Purgatory, the right and best thing to do for them is to pray for them in the present moment, as you suggest. Pray that they may soon be released from Purgatory—and incidentally, ask them to pray for you that you may not have to go through that.