But the example you gave was of a wanted baby. In those cases, the obstetrician would assume that the mother wants to give the baby the best chance that her own health allows.
This would be a different scenario, in which the mother chooses to invoke her (hypothetical, new) right to have her pregnancy ended, regardless of the effect on the baby. Luckily, I don’t think many women would choose this option, but a baby born past 30 weeks and given intensive neonatal care normally has an excellent chance.