How could I have avoided this accident?
My tactic would be slower not faster and basically minimise the weight over the front wheel as much as possible by moving my backside as far back as possible. With higher speed and weight at the front I'd say you're more likely to dig the front wheel in.

Again I'd use the back brake, you need the front for steering as much as possible and you may loose that with braking on the front, also with the weight at the back the rear will be better for braking.

Forgot to add,  try braking as much as possible before the muddy bit, and as little as possible whilst going through the mud. Braking will load up the front wheel and hence more likely to dig in.