Who cares what the motivation of the cat was, its presence likely saved the baby.
Thank God the cat was there.
That cat’s motivation was most likely it spotted a box, also known as a cat trap, and climbed in. The staying with the baby who was occupying the cat’s new found property was secondary.
My cats can’t wait until I get home from Costco so I can throw the empty boxes on the floor.