So I'll write this up on the case but this looks like the expectation here is that the rendering order to match what OnMouseDrag returns. OnMouseDrag isn't a 2D physics thing, it's a Camera thing and it simply uses a 2D physics query (https://docs.unity3d.com/ScriptReference/Physics2D.GetRayIntersection.html) to ask what's there but 2D physics doesn't know about render order and because it's 2D, it has no Z (no depth) either. This query does sort by Transform Z on the GameObject though but in the project, both GameObject are on Z=0 so the order is undefined and the first one encountered will be returned. Changing the IsTrigger (which causes the collider to be regenerated) likely just changes the undefined order so you'll get a different collider returned.