Create an input_boolean helper called “interlock”, or “override” or something similar.
Set this input boolean on in your third and fourth automation actions.
Use a condition in your first and second automations that wont run the actions if the state of this input boolean is on.
How you turn off this input boolean depends on what you are doing in your third and fourth automations.