In more ways than one. There is credible evidence that your gut bacteria play a non-trivial role in your personality, and especially on what food you want to eat on a given day. You like food that your gut biome likes.
As someone who suffers from anxiety, the poops give me more anxiety and lack of access to bathrooms gives me anxiety which causes me to poop even more. It's a never ending cycle.