I got food poisoning while abroad shortly after college, and took some shitty OTC antibiotics. I was low-grade sick for ~1 month, and when I came home I started developing IBS which got progressively worse over the next few years. FODMAP saved me, but at the detriment of needing to eliminate a lot of foods that I loved eating.
Recently I started eating 2tbps of chia seeds with some lemon juice and water daily. Chia seeds are incredibly fibrous. Over the next month, my stomach seemed to get permanently better - I can now eat larger quantities of some of those "problem" foods without debilitating side effects.
The bacteria in your gut affect a whole lot of things. And there are competing cultures, all of which like to eat different things. My hunch is that I coaxed the fiber-loving ones back to health, and they in turn did me the favor of repressing the cultures that liked fermenting beans and cruciferous vegetables. There's a lot we don't know about our gut microbiome, but my guess is that eating high-fiber, high-diversity diets is a much better solution than taking a pill.