I don't know what the cause was, but the gut-brain theory fits all of my experience and treatments aimed at improving my gut bacteria helped the most, and there has definitely been a strong connection between how my gut is feeling and how my mind is feeling.