Tilemap rendering order (939010)

I’m trying to fill a tilemap with some sprites at runtime, and they are ordered at z-axis from farthest one to closest, like this:
Shadow - {0,0,0}
Sand - {0,0,1}
Shadow - {0,0,2}
Ground - {0,0,3}
Grass - {0,0,4}
There are up to 6 tiles in a row, and everything is fine until the 6th one is placed: It’s rendered behind the 5th one. It’s true until there are some fixed amount of tiles in total, around 49. But also not always) Seems like either randomly, or depending on some other runtime operations z - ordered tiles can be rendered properly or wrong. Could someone clarify what’s going on, or point me to something I could read about it?

Use the sorting layer and layer in order to control their render order: https://docs.unity3d.com/Manual/class-SpriteRenderer.html

use transparency sort axis, set it to 0,0,1