While somewhat hacky,
The way i use layers may be suit your game.
The game i'm making has a base grid of 64x64 px. It's isometric so i have to have a efficient z ordering system.
This only works if all your objects have a base the can be divided by itself. For example units use a base of 1x1, walls 2x2, big buildings 3x3 etc etc.
I translate the layout angle to itself -45, thus giving the feeling of 'isometric'.
So if the base grid is 1x1(*32px), and say the width and the height of the world is 50x50. Then i have 99 layers in game.
For static objects, on.created move to layer int(object.x/32 + object.y/32).
For moving objects, such as player or monsters, for each object, move to layer int(object.x/32,object.y/32)
If your game is using a normal angle, then you can simple add 1 layer per y height / base tile.
So now on create move to layer int(object.y/32) ` same with every tick.
In game this works really well.
However the downside to this is when debugging. The debugger will be checking every layer, so its runs at a crawl.
I hope i explained it well. I can post a screenshot of how it works if you need.
Best of luck,
Tom
For static objects