Just want to clarify that the majority of human births don't involve "The Delivery Doctor" as you say. Historically and even today, the majority of women who've given birth have done so without a "delivery doctor." Many women have given birth with no medical assistance at all, and continue to do so today. But even in the case of those women who have given and will give birth with medical assistance, the HCP in most of the world is more likely to be a midwife not a "delivery doctor." Outside the US, physicians are only called in for high-risk births and C-sections.
When there is a midwife or "delivery doctor" present at a birth, IME she or he does not usually announce whether a baby is a boy or girl once the infant is born the way it's often depicted on TV and in movies and the way you describe.
Instead, many HCPs, including a good number of doctors, customarily allow the mum (and dad or partner) to see for themselves. It's been customary for many decades now for women who give birth vaginally and through C-section to use mirrors so we can watch our babies come into the world with our own eyes. In the case of women who eschew using mirrors, as I did, the babies are often/usually placed on the mum's chest with cord still attached so that she can see her naked baby and make note of what his/her genitals look like for herself. The midwife, doctor or anyone else present at the time doesn't have to tell her what her baby's sex is.
In births that occur in a medical setting such as a hospital or maternity center, the midwife or "delivery doctor" is not necessarily or usually the person who records the sex of newborns in the medical files. That's more often than not the job of pediatrics nurses and pediatricians who medically examine newborns and record their details - length, weight, Apgar score, distinguishing features such as birth marks or anatomical anomalies - soon after birth.
Most relevant: whatever "the delivery doctor" or midwife might say, the fact remains that in most jurisdictions, the responsibility of registering births and applying for birth certificates rests with parents, principally mothers. If you give birth in a medical setting in the US, the health care facility might provide the paperwork and offer to file it for you. But it's the parents or parent, principally the mother, who signs the documents and legally attests to the child's sex. The word that matters most in establishing a child's legal sex is usually the word of the mother, not the authority you call the "The Delivery Doctor."