Well I don't think a master Z layer exists, it seems to me that your problem can be fixed by using a move to layer
Assuming the number of layers is the same for all layouts.
If you want to have a different number of layers on some layouts, you should have a global variable with the number of layers and set it at the start of a layout.
If this doesn't solve your problem, maybe you should reconsider your layers.