Why will Blender sometimes not select the object under the cursor
Because there is margin distance (in screen pixels) such that blender will select an object even if you click slightly next to it.

So that mesh gets selected instead of armature because it is on top of the armature and the pointer is within the margin area. When you zoom in the pointer is no longer in margin area and the armature is now the top most object.

Honestly blender could do picking much more smartly and also check if something is directly beneath pointer even if closer_to_camera mesh qualifies for selection.