Oh it took me 7 loops. 4 for the first three layers, and got fourth layer (water) started. Then took 2 more loops to finish water and 1 loop to finish the toxic air.
This was mostly due to resource starvation, so not sure how you could complete it all in 5 loops, without cheating.