Mortality risk in pregnancy never goes to zero. Many other species (such as salmon, octopi, many insects, arachnids) have a mortality rate close to 100% for either one or both parents after reproduction. Ultimately it is a tradeoff over resources between parents and offspring. Many other mammals have smaller offspring than humans though they lack humans’ large brain volume relative to maternal pelvis size. Scientists have debated about the reasons for women’s small pelvis size relative to the baby’s skull size and the rough consensus seems to be a tradeoff between intelligence and walking/running ability as well as agility.
Your definition of sexual maturity would seem to imply that the optimal time to have children is when a woman’s maternal mortality risk is minimized but that assumes all other risks remain constant over time. They do not, especially not in the past when famine was a much greater risk and all-cause mortality was much higher (including infant and young child mortality). This means the optimal time to have children would be much earlier given that famine or disease or other misfortune could strike the family at any time and that children matured into productivity quite rapidly (children didn’t always go to school for 12 years). It should also be noted that famine and the associated loss of body fat can halt the menstrual cycle in women of any age.
Lastly, I need to point out that many traditional and indigenous communities throughout the world have or previously had initiation rites to welcome children into adulthood and full standing within the tribe at or around the age of puberty. Contemporary society with its emphasis on more and more schooling has been the primary driver of the push to longer and longer periods of adolescence. The mental health and physical development effects of such extended adolescence are only beginning to be understood.