Mind over (fecal) matter

Do I really need to preface with a TMI? Anyway, I was just wondering why, especially when I have a touch of diarrhea, I can walk perfectly calmly to the men’s room, but from the moment I actually enter the water closet I’m suddenly hopping from foot to foot and as soon as the stall door closes behind me I’m irresistibly compelled to rapidly and fumblingly detrouser myself and slam into position lest I inadvertently create a modern art masterpiece all over the walls.

Has there been any study of why one’s bowels suddenly get that signal to RELEASE NOW based solely on physical location?

An SDMB classic.

Possibly a similar phenomenon to the urge to urinate suddenly arising if someone asks “does anyone need to go to the bathroom” before a road trip?