The remnant yolk sacs of eggs evolved into the umbilical cord. It was much safer to have your fetus growing inside you than to have to lay eggs which proved as an evolutionary advantage for mammals and marsupials. Quoting: AllGunsBlazing
So basically, the eggs starting growing inside animals, which was advantageous. What was the yolk and other parts that are present in eggs, are still present in human embryos as well. Our early development is strikingly similar to reptiles' early development.
Disregarding the fact that your explanation is purely 'just-so' speculation... Do you realize how many perfectly coordinated changes would have to occur in order to switch from an Ovoviviparous egg development and Viviparous placental gestation, while constantly conferring enough of a fitness advantage to become fixated in the population???
This supposed evolved fetus might be safer in the mother's womb, but how on earth do you reconcile a fitness advantage to the mother herself, now having to bare the burden of prolonged pregnancy??? Embryo safety is meaningless without survival advantage to the mother.
Where does her fitness advantage arise from bearing the extra weight and having to supply extra nutrition?
If these intermediate stages were so beneficial, how come there is not a trace of evidence for this body plan? Why no organisms using an intermediate gestation stage today?
Oh yea, let's not forget that we don't observe a single novel protein evolving today, much less the myriad of coordinated protein transportation systems evolved in embryonic development systems.