If anyone finds this thread in the future:
I found a more versatile system that works thanks to user LukeH over on the Godot Engine FAQs.
Apply this shader material to all your meshes, and it'll ONLY output to the z-buffer. So it has the same effect as manually writing to the z-buffer, but you can re-arrange the meshes if need be.
shader_type spatial;
render_mode blend_mix,depth_draw_always,cull_back,diffuse_burley,specular_schlick_ggx,unshaded;
void fragment() {
DEPTH = 1.0;
}