When you have mobile objects and you want to get their draw order, there are two possible approaches how you can preprocess them before drawing:
Add a list of objects to each map tile. Iterate all objects and add them to the object list of the tile they are on. When you draw each tile, you first draw the tile itself, then sort its object list, then draw the objects, then delete the object list.
sort all objects by draw order. Then draw them all after drawing the map. Map tiles which obscure objects behind them need to be treated like objects in this case.
Option 1 is best when the objects move so quickly so they are in a different order every frame or when you have a lot of immobile objects, because you can then treat them like tiles.
Option 2 seems slow at first, but in most games you can make it a lot faster by using the right sorting algorithm.