In Skia layers get rendered in the order in which they are either:
Connected to the Group node
Ordered inside the spread that goes into the Group (Spectral) node
You probably have a spread of layers here, so you need a way to reorder the spread so that the slice of the layer you want to display on top is at the very end of the spread. Thats the logic behind it.
Now I am pretty sure there are different ways to achieve this. You could use a combination of GetSlice, RemoveSliceAt and then combine the slice that you extracted with GetSlice with the spread of which you removed it from.