It also is a closed loop immune system sharing with the mom.
The child transfers whatever it is fighting to the mom's nipple when breastfeeding, the mom's immune system reacts, and in the next feeding the milk contains a response for the child.
From the Wikipedia article: “Several studies have shown that there is a mother-to-infant transfer of bacterial strains belonging, at least, to the genera Lactobacillus, Staphylococcus, Enterococcus, and Bifidobacterium through breastfeeding, thus accounting for the close relationship of bacterial composition of the gut microbiota of breastfed infants with that found in the breast milk of their respective mothers.”
》While the origins of the human milk microbiome are not exactly known,[1] several hypotheses for its establishment have been proposed
》Alternatively, bacteria may be translocated to the mammary duct from the maternal gastrointestinal tract via an entero-mammary pathway, facilitated by dendritic cells.