I splited surfaces by curves, then the order of surfaces became a mess.
I have tried to Sort surfaces by distance between the center of each surfaces and a point of the red lines as below.
But only B part is correct.
There is even flipped part as A part.
when I see some sorting of points does not look right, I always drop a line component on the canvas to check what actually is going on in the data tree
you can use the nice solution shown by @Petrol , or use a few trim tree and partition list in your definition to break and rebuild the outmost branches of your data tree after the Distance component