Chiming behind the lemming who said the water a few minutes prior going won’t do anything. It certainly won’t do absolutely anything no matter how much you drink. Once the bowel absorbs the water, adding more water to your body won’t restore moisture to the stool.
What probably happened in your case is simply peristaltic movement, some people are more sensitive to it. So chugging a generous amount of water stimulates your gut tissues and encourages things to get moving along.
Going back to the water - of course if you stay hydrated and keep things hydrated it will help. But you cannot rehydrate a stool just by drinking.
the water a few minutes prior going won’t do anything.
That depends entirely on which end you put the water in