Give him something starchy, potato, bread, pasta/mac n cheese etc
Yoghurt?! That’s gonna make it worse. I give yogurt to my son every day to keep his stools soft and regular.. Dunno why the Dr mentioned yogurt. Sounds like it’s gastro or teething poops. Give him more bread, pasta, rice. Starchy foods. More fibre. Bananas. Carrots (things that in abundance usually causes constipation but good for your current situation) Even when my son had gastro he didn’t leak through though because we used cloth diapers they have real elastics. If you have some swim covers you can put that on top so the poop stays on you’ll still have to rinse and wash them but at least the poop won’t touch his clothes and only that. Or boys trunks size 3-4 and that over the diaper if you want. Keep them for later. Should be only temporary though if he doesn’t leak any other time but now.
He’s 9 months old btw!