The American Gut Project found higher rates of beneficial bacteria in the microbiome of onion eaters. Not sure if they even stated a reason, perhaps an effect for which we are unable to fully understand the cause of.
Cause and effect, we can only fully see effect, cause is a best guess.