Not only that we know that fetuses can perceive the world. We know fetuses recognize its mother's voice in the womb.
https://abcnews.go.com/Technology/story?id=97635
And premature babies benefit from hearing their mother's voice.
https://www.psychologytoday.com/intl/blog/shouldstorm/201909...
The only mystery is the neurological mechanism of how the brain is and gets wired.