How do I replace “stepper_z” with “stepper _z1” with a macro?

That kinematic did not support what you wanted to achieve directly. However, now I added a new command SET_STEPPER_KINEMATICS and it can be used to disable or re-enable the steppers as explained in the last post there. So with that, you could probably do

[gcode_macro Z0]
gcode:
  SET_STEPPER_KINEMATICS STEPPER='stepper z1' KINEMATICS= DISABLE_CHECKS=1
  SET_STEPPER_KINEMATICS STEPPER='stepper z0' KINEMATICS=z

[gcode_macro Z1]
gcode:
  SET_STEPPER_KINEMATICS STEPPER='stepper z0' KINEMATICS= DISABLE_CHECKS=1
  SET_STEPPER_KINEMATICS STEPPER='stepper z1' KINEMATICS=z

Assuming you define that new generic_cartesian kinematics as explained in that thread and [stepper z0] and [stepper z1] specifically.