Normally printer does not know. That is why we do not touch Z and send G92 Zxx when resuming with xx the last z height in servers log for the start position you did choose. Normally you would add only home xy except printers that can home to z max - these should home all axes instead.
No variable. With rescue active we write a log what has been done and from there and the gcode we extract the last z position that we then use to send G92 Zxx. It is nothing you can add your self in start code. In start code you just write e.g. G28 X0 Y0 to put extruder out of the way. The G92 Zxx gets send when you start the restore print. Of course your printer must be able to move Z without rehoming (some are configured to only move when homed).
Comments
G92 Zxx
xx?