Right, it's the same z-buffer problem of deciding what pixel color is visible, with a non-blending buffer update mode.
To be totally coherent, you have to draw the entity ID in the same order you would draw the visible color, in cases where entities could "tie" at the same depth.