The poll function accepts hidden objects, so they are not stuck in pose mode, but the operator itself expects a valid base, which we don't have. When called from OBJECT_OT_mode_set() it will fallback to object mode. It is the same that happens when in Edit Mesh mode with a hidden active object and trying to change to Vertex Painting mode.