Magnesium is known to relax smoothe muscle tissue.
The common bile duct is smoothe muscle; I am not exactly sure about the biliary tree ducts being the same but they probably are.
People have used other forms of magnesium in the flushes such as citrate or malate. Some people do not use magnesium at all.
The advantage of using Epsom Salts
is also the disadvantage depending on perspective.
Using it in high dose as a laxative has the benefit of clearing out anything in the digestive tract prior to the flush which makes it easier for material to be released into the small intestine and then into the colon.
For some people taking a strong laxative is not a plus and they will like you said suffer the effect of electrolyte depletion.
Pick your poison.
If you are that sensitive to a bout of diarrhea prior to flushing I would suggest that you concentrate the rest of your non-flush time on storing up on electrolytes and daily hydration. This way a single event will not have that much of an effect on you.
Imo magnesium glycinate is perhaps the best form to take as it is absorbed very efficiently and does not cause loose stool.