Battwell,
I am a complete novice, so take this with a grain so salt. I am very much just starting to learn macro editing in mach.
I think your moves run into eachother. Without a While IsMoving/Wend after each move, it immediately feeds that data into Mach. A few milliseconds after you initially told mach "G53 X0", you told it to dwell for 0.5 seconds. Without the While Ismoving/Wend, these two commands pretty much happen simultaneously, that is, the 0.5 second clock started at the same time as the initial "G53 X0" command.
I realize you would break syntax if you tried to put the While IsMoving/Wend command within your current conditional loop (after each motion, to inhibit any commands until complete). Perhaps you could, instead of the { Code "G4 P0.5"} command, try a {Sleep 500} command. Of course, you would want to add the required motion time to that number.
I would love to hear the correct answer, so I will be watching this thread.
Cheers!
Rob