layers over z position fix??

Hi. So I've been trying to make a rubik's cube. I've precomposed every single little cube and then built this using z position, and parented every individual wall to a null object layer, and all the null objects to a bigger null object for everything, but when I spin it to the other side, for example y rotation, (as you can see the bottom row) it keeps the z positions under other layers even though I spun everything. How do I fix this? I feel like I've tried everything ;-;
