It is based on science, science that the toddler will learn during that relationship. It is the nature of the dog to be a pack animal. That is how it evolved, and is why it interacts with humans so well.
In most cases, dogs live into their teens, so that toddler will be in or out of high school by the time the dog dies. By then, that child will understand the biology of life and death and will bury the dog, knowing that animals, including him or herself have limited lifespans. In most cases the boy or girl and the dog will have formed a close relationship, and the boy or girl will be sad when the dog dies. It will be an important thing in that person's life, and will be understood in many ways.
How do I know this? I lived beyond the lifetime of my own childhood dog, and the guinea pigs, and a tortoise, and a couple of cats, some fish, and several other small pets. I did not appreciate them less for knowing their biology and how it related to mine, and I did know those things by the time I was about 8, and had read many books. I was saddened by their deaths, especially the dog, but I understood their deaths. I buried them in my parents' backyard, and know exactly where each of them was buried, although my parents have long since moved. My parents are both 88 years old. I'm intensely aware that I will be burying them within a few short years. I will understand why they died, and will still mourn their loss. But, they will have lived excellent lives and I will be glad of that.
You speak nonsense, because you speak only from one perspective. What you say was simply not true in my case, and is simply not true in the case of many people. I know my own story well. I am intimate with it. You do not know me at all, and cannot describe my experiences.