Someone on github found my mistake.
Since Z homes in the positive direction, Z1 uses the ZMAX endstop (not MIN as the other axis do).
So for Z2, I need to use ZMIN endstop (or I could use XMAX if I wanted to, as that one is also unused).
Tried that and it compiles and works perfect. I feel like an idiot