How do I reprogrammed hindsight into foresight

An incident happened lastnight, which is making me think about changing behaviour.

We’ve got two sick kids at the moment and we had decided that they sleep separately and  one of us would sleep with each child to ensure they were comforted and not alone (they are used to sharing the same room so freak when they are apart).

DW laid out a plan, which was eldest would sleep with her in our bed, I would sleep in the children’s room with our youngest in the other bed. Fine plan, I enthusiastically agreed to it.

DW started drinking about 6ish on an empty stomach, as well as being a heavy drinker (she drunk 5 pints of lager in total last night) she’s a lightweight when it comes to booze. An interesting combo, she gets drunk easily yet continues to “gorge” herself until all the booze is gone or she’s stopped by some external factor.

She took our eldest to bed settled her and got her to sleep. This was about 8pm. She neglected to tell me that she’d switched rooms, once she came down I proceeded to take our youngest up. It was at this point, while I was carrying a sleepy child that the rooms had been switched from the original plan.

A minor annoyance, so I put our youngest in our bed, settled her and we both fell sleep.

All good so far, except:

DW carried on drinking and then took two nytol, this puts her into a very confused state (it’s quite unpleasant to see). Then I gather she went to bed with our eldest.

At half past two in the morning, she got up to go to the toilet and then crashed into our bedroom, pushing and shoving her way into our bed, I woke up and asked her not to do that, she mumbled and carried on. Finally, dragging the duvet off both me and the youngest. I tried at that point to sort out the duvet to cover all of us yet DW pulled off again.

Finally, frustrated I slapped her somewhere (one of those backwards, in a vague direction what the hell are you doing slaps) and told her “to fuck off back to the other room, you drunken oaf”.

Which she did do, with a lot of mumbling. My youngest was shivering at this point and told me she was scared. I settled her back and that was the end of it.

With hindsight, at the moment DW staggered/crash into our room, I should have:

Let her get into bed.
Got out myself.
Covered every one up with a duvet.
And slept on the sofa.

Instead an abusive/violent situation arose.

Things I should do going forwards.

This situation will always continue to happen (or variations of it – each one slightly different but high level all the same).

Learn to remove myself immediately and not be involved unless a real safety issue arises.