Sorting on y and x axis workarounds

Godot Version

godot-4,

Question

I am trying to create something with a perspective like Ultima 7, and got Y-sorting working properly.

But since the type of perspective in principle also need x-sorting as walls can overlap sprites on the left, is there a way to work around it except by expanding the collision regions? I.e. attached image shows what happens if you walk close to the walls on the left side (this works fine on the right, bottom and top sides).