Hey Tim,
I don’t know why you should have replaced a stepper motor, especially not before having checked and/or replaced all cables and connectors involved (except if the motor’s connector is failing and you don’t have the capability to replace and recrimp the connector yourself). If you look at this, and generally consider this, you know what you should look for. Stepper motors are by far not as common a cause of failure as these tin-plated connectors, which also lack strain relief (in fact the have a little strain relief on each contact in form of the insulation barrel, but these connectors are explicitly not made for use in moving parts (like in a CNC) and therefore necessite the use of strain relief.
The other point, coupler slipping, should also be a suspect when encountering Z positions issues. This is point 4) (ball screw coupler) in this FAQ document. If the Z axis’ ball screw coupler slips, this could be an error that could appear under load and not when milling air.
The flat surface on the motor shaft has to be aligned with the tip of the grub screw on the coupler.
While you’re at it, you could also check if the ball nut set screws are tight:
But first I would check and/or replace every cable and connector involved.