This seems to do what you want.
Put this expression on Position (Copy the expression, Alt-Click the Position Stopwatch, then Paste):
n = index % 18;
if (n==0) n = 18;
x = thisComp.layer(n).position[0];
y = thisComp.layer(n).position[1];
z = position[2];
[x,y,z]
Put the expression on one layer, then Edit>Copy Expression Only, then select all the other layers and Paste.
This expression works off layer order, so your camera and lights, everything else, needs to be below the 150 layers you have (or was it 140?) that have this expression. Anyway, layer 19 will assume the x and y or layer 1 but retain it’s on z. Later 20 will use layer 2’s x and y, but retain it’s own z., etc. So every 18th layer will have the same x and y but their own (whatever you set it to) z. This expression works for me even on the first 18 layers (didn’t know % (modulus operator or remainder) would do that). They need to be 3D layers and on top of the stack, or it won’t work. I tested it on 180 layers, and it seems fine.
If it doesn’t do what you want get back to me, this is my first foray combining index (layer order), % (modulus operator) and if.