I recall there's a thing where those that undergo major gut surgery, which would disturb the gut biome, have a much higher chance of falling into substance use disorders afterwards.
Though a lot of gut surgery would be for bariatric weight loss, so there could be many other drivers for that correlation.
I’ve wondered whether a colonoscopy (prep for which which completely empties the gut through the use of heavy laxatives) could strongly affect your gut biome.