The fundamental structure of human populations has changed exactly twice in evolutionary history.

The second time was in the past 150 years, when the average life span doubled in most parts of the world. The first time was in the Paleolithic, probably around 30,000 years ago. That’s when old people were basically invented.

Throughout hominid history, it was exceedingly rare for individuals to live more than 30 years. Paleoanthropologists can examine teeth to estimate how old a hominid was when it died, based on which teeth are erupted, how worn down they are, and the amount of a tissue called dentin.

Anthropologist Rachel Caspari of Central Michigan University used teeth to identify the ratio of old to young people in Australopithecenes from 3 million to 1.5 million years ago, early Homo species from 2 million to 500,000 years ago, and Neanderthals from 130,000 years ago. Old people — old here means older than 30 (sorry) — were a vanishingly small part of the population. When she looked at modern humans from the Upper Paleolithic, about 30,000 years ago, though, she found the ratio reversed — there were twice as many adults who died after age 30 as those who died young.

The Upper Paleolithic is also when modern humans really started flourishing. That’s one of the times the population boomed and humans created complex art, used symbols and colonized even inhospitable environments. (The modern humans she studied lived in Europe during some of the bitterest millennia of the last Ice Age.)

Caspari says it wasn’t a biological change that allowed people to start living reliably to their 30s and beyond. (When she looked at other populations of Neanderthals and Homo sapiens that lived in the same place and time, the two different species had similar proportions of old people, suggesting the change was not genetic.)

Instead, it was culture. Something about how people were living made it possible to survive into old age, maybe the way they found or stored food or built shelters, who knows. That’s all lost — pretty much all we have of them is teeth — but once humans found a way to keep old people around, everything changed.

Old people are repositories of information, Caspari says. They know about the natural world, how to handle rare disasters, how to perform complicated skills, who is related to whom, where the food and caves and enemies are. They maintain and build intricate social networks. A lot of skills that allowed humans to take over the world take a lot of time and training to master, and they wouldn’t have been perfected or passed along without old people. “They can be great teachers,” Caspari says, “and they allow for more complex societies.” Old people made humans human.

What’s so special about age 30? That’s when you’re old enough to be a grandparent. Studies of modern hunter-gatherers and historical records suggest that when older people help take care of their grandchildren, the grandchildren are more likely to survive. The evolutionary advantages of living long enough to help raise our children’s children may be what made it biologically plausible for us to live to once unthinkably old ages today.

• • •

No matter how many grandmothers were around during most of human history, though, many children didn’t survive. Until the 20th century, most deaths occurred in children and infants. According to most estimates, a quarter to half of them died.

We’re now on the other side of the second great demographic change in human evolutionary history. The main reason life span doubled in the past 150 years is that infant mortality plummeted. Just as having old people around changed human culture profoundly 30,000 years ago, having infants and children survive has fundamentally changed modern society.

If you walk through an old cemetery, you’ll see all the tiny headstones of nameless infants. The small Bolen graveyard in Shenandoah National Park has about 40 stones that are still legible: Infant son of John H. and Lula Hindall, Born & Died Jan. 15, 1913. Daughter of Waverly H. Bailey, age 11 days. Mollie E. Pullin, Age 7 Years, Gone Home. Some cemeteries are full of infants buried next to mothers who died in childbirth. It’s like strolling through the medieval wing of an art museum: Everywhere you look is Madonna and Child, Madonna and Child.

Parents knew they couldn’t expect infants to live. In the United States and other parts of the world, infants often weren’t named immediately; a tradition in China and other parts of Asia is to name a child only after 100 days. According to some interpretations of Jewish law, if a baby dies before 30 days, it never really lived. Was this meant to keep parents from getting too attached to their children?

People certainly grieved when they lost a child. But overall, parents’ relationships with their children were fundamentally different than they are in much of the world today. “It was very difficult to invest emotionally because at least half of them would die,” says S. Jay Olshansky, a longevity researcher at the University of Illinois at Chicago. And the history of infanticide, child labor and child abuse — outright torture by today’s standards — shows just how cheap young lives were.

But then infant and child mortality declined, and with it, so did fertility. Women didn’t need to bear replacement children for the ones who died, and they could be confident that a baby would live to adulthood. Survival became expected.

Today, things have changed. Infanticide has become a shocking crime. We go to heroic financial and technological efforts to save every newborn. The United States’ high infant mortality rate compared with other developed countries — about 0.6 percent of all live births, which is tragic but a lot better than the 25 to 50 percent it was in the past — is considered shameful.

As Darshak Sanghavi, chief of pediatric cardiology at the University of Massachusetts Medical School, points out, the data is complicated but mostly explained by a high rate of premature births. Neonatal medicine is one of the highest-paid medical specialties (to the point that we may sometimes be doing too much for preemies), and it has made constant improvements in the survival rate of the smallest neonates.

Children were the focus of many early public health drives — for clean milk, vaccinations, proper nutrition. Today children’s safety is the motivation for many product recalls, from cribs to window blinds to magnetic balls. Letting children roam unattended is almost as unthinkable as sending them to work in a textile factory. I don’t mean to make light of these precautions — they’re a sign that we’ve become more civilized and humane, that the world is a better and altogether different place than it was more than a century ago, and it’s all tied to our new expectation of long and healthy lives, starting at birth.

It’s the best time in the history of the world to be a child, a parent or a grandparent.

• • •

After the increase in child survival, the other major demographic change to come from the doubling of average human life span is a robust population of old people. In 1850, the proportion of people 60 or older in the United States was about 4 percent. Today they account for about 20 percent of the population.

Economists fret about declining birthrates in the developed world and the challenge of financially supporting large elderly populations. But old people are awesome. Having a high ratio of older to younger people isn’t just a consequence of living in peace and prosperity — it’s also the foundation of a civilized society.

Things go horribly wrong in societies composed largely of young people. The Lord of the Flies is fiction, but the Lord’s Resistance Army — in which tens of thousands of Ugandan children are thought to have been kidnapped and turned into bloodthirsty killers — is all too horrifyingly real.

Old people aren’t merely less bellicose and impulsive than young people. They’re also, as a group, wiser, happier and more socially adept. They handle negative information better, have stronger relationships and find better solutions to interpersonal conflicts than younger people do. Laura Carstensen of Stanford is one of the leading researchers in this field, and she says the fact that the population is getting older is “going to change every aspect of life as we know it, including education, politics, culture and the nature of relationships.” That’s because older people “have greater knowledge, better emotional stability, and they care deeply about making a meaningful contribution.”

“If you could take everything desirable about growing older and put it in a pill, do you know who would take it?” says Olshansky, the longevity researcher. “The young.” The magic pill would confer “a profound sense of self-confidence … a sense of peace and joy that comes from decades of a loving relationship … the sheer joy in caring for grandchildren … financial security … and thoughtful reflection and intelligence.”

If life span is going to continue to increase throughout the world, it may well require a positive feedback loop like the one that allowed humans to flourish 30,000 years ago. As then, more old people may lead to public health and social justice improvements that create more old people, who make the world an even better place. Something to look forward to.

Laura Helmuth is the science and health editor at Slate, where a version of this essay first appeared. Follow her on Twitter at @laurahelmuth.