I think it's also important to note that not all animals DO know what to do when they have young. Many primates must learn infant care from parents and siblings in order to be successful. Many first time animal parents get things wrong--but they gain practice with subsequent offspring. read more
For example, most dogs will have a high tolerance for annoying shit babies do -- an adult will pull their tail or slap them and they'd bite back or growl, but the baby does it and they just sigh or walk away. And it's pretty common for family dogs to want to hang around the baby 'guarding' it. This doesn't mean it's safe to just leave your baby around a dog unsupervised, even if it's your loyal family dog. But yes, dogs do understand that babies are different. read more