OK there is the 4.5 " offset in the g54. That was why I asked in the beginning about fixture offsets. I Bet you have mach set to cancel all offsets on a M30 (;-) if so when the M30 ends the program it removed the 4.5" of fixture offset.
That could be part of the problem.
Still a little weird about the switch when it converts over to G21. It does it here as well, BUT if you rezero after it does it it does no harm. But IF you don't rezero it will go to another location.
Just a thought, (;-) TP