People imagine some special mechanism of transfer, but the reality is that we get bacteria from inside and outside of our bodies all over stuff, all the time, and we’re crawling with it. The babies would be introduced to GI tract flora pretty much immediately even if you tried to prevent it (unless you prevent it with antibiotics of course).
I think there is even some evidence that cesarean births have higher risks of some infections because of not being exposed, I even recall that they did some things with babies being born with cesareans because of this.
But the feces is sterile. It's not even feces exactly, it's meconium and doesn't look like feces and doesn't smell at all (it's basically the remains of cells from the intestine and the amniotic fluid the baby swallows).
Amniotic fluid and blood is sterile.
Newborns acquire their biome once born by ingesting various food and contact from family members.