The ancient Sage Ashtāvakra (literally, malformed in eight limbs) happened to get that way owing to a curse that his father pronounced on him while in the womb, because he was enraged by the baby’s reference to his erroneous enunciation of a Vedic mantra.
Tradition says that the father later relented and suggested to his now grown son to bathe in a certain pond to regain his normal physique. Ashtāvakra’s parents were Kahoda and Sujata, who were both students of Aruni, Sujata’s father.
Obviously, fetal Ashtāvakra had a lot of opportunity to hear the Vedas recited correctly. He remembered enough of it to correct his father and get into trouble.
The point here, though, is that fetuses can absorb any amount of information while we think that they are sleeping blissfully in their mothers’ wombs. They bring all that information into the world with them and use it to influence their societies.