HMOs are not for the baby. They are for the bacteria the baby is trying to grow. Specifically, HMOs support the bifidobacteria that dominate the gut of a healthy breastfed infant, with Bifidobacterium infantis being the most studied example. When those bacteria flourish, they produce short-chain fatty acids that help support the gut barrier, support the developing immune system, and support comfortable digestion.
This is what makes a synbiotic different from a probiotic alone. A probiotic introduces beneficial bacteria. A prebiotic feeds them. A synbiotic does both at once, which is what breast milk has been doing for the entire history of human development.