Perhaps the gargoyle hadn’t locked Umbridge out - Harry wasn’t against believing that the castle had the capacity to be sentient (he felt that the Room of Requirement proved that), but he didn’t honestly believe that that extended to the gargoyle in front of him. If the gargoyle was a trusted judge of character, why bother with a password at all? No, perhaps the office hadn’t locked her out, but rather Dumbledore had changed the password as he left? That made more sense to him. But to what?