This is likely a timing / template extension problem.
See Help with Macro: SET_GCODE_VARIABLE doesnt set my variable - #12 by theophile and maybe Help with Macro: SET_GCODE_VARIABLE doesnt set my variable - #15 by Sineos
The flow should be:
- Call own “disable sensor” macro
- Call Extruder change macro (maybe even with a short delay to 1.)
- Call own “enable sensor” macro (maybe even with a short delay to 2.)