I think the problem may be that the supply voltage to the stepper controllers is drooping with the additional load of the A axis being energized. It is possible the voltage is fine while not in motion but when stepping the power supply capacitors are unable to supply the peak current needed for each step.
As the voltage drops the maximum speed you can step the motors with a load drops. If the motors are commanded to step faster than the voltage / load allows steps will be missed.
In your case the rapid Z movement upward is probably dropping steps. A quick fix would be to use a G1 with a moderate feed rate command instead of G0 that runs at maximum feed rate. You could muck around and reduce the G0 feed rate but when the 4th axis isn't there you would be limiting your rapid feeds when no necessary.