I had some problems (2D platformer) using YSort + Node (Node for container... Enemies for example, and inside that Node every enemy). The YSort breaks
My approach was make an excel with "node" "z index" for memory and ZIndex calculations, and not touching any YSort on Godot, just managing ZIndex
So... for example
Tilemap World --> -100 ZIndex
Player --> 100 ZIndex
Enemy --> 50 ZIndex
Objects --> 20 ZIndex
and so...
The "big" values are in case I need to add something between
Not ideal but works for me
Of course this can be a mess with relative ZIndex and calculation if you dont get track of values (in my case that excel is mandatory for this).