Cleanup compositor recursion

There's a lot of ad-hoc recursion in the `CompositorData` code. It would make more sense if methods were layer-specific, and a separate function was called to find a specific layer recursively.