Qualified immunity started off as an improvement on the old rule of "the king can do no wrong" complete immunity. When that was done away with, it seemed unreasonable for an officer, or other public employee, to be held liable for actions in "gray" areas, or where the law had recently changed, but the officer likely had no knowledge of that change. Clearly unreasonable actions would make him liable (No Officer Chauvin, 9 minutes is NOT a reasonable length of time to kneel on someone's neck). At the same time, officers were not required to be better legal scholars than the judges who had only recently contemplated their navels and come up with some new rule of law.
The qualified immunity standard was supposed to immunize an officer if he acted in a manner, or on a matter, where there had been no clear statute or case law finding that action, or similar actions, unreasonable. Unfortunately, judges are lawyers, with all the mental and attitudinal frailties evident in that profession. Thus, they established a rule that the situation previously adjudicated had to be Exactly the same, not just so close that any person with an ounce of common sense would know it covered this instance also. That standard is what caused the New Mexico legislature to repeal the immunity.
Unfortunately, this also is a wide swing of the pendulum, which has already resulted in insurance companies quoting much higher rates to local governments for liability coverage. This may result in unintended consequences such as loss of volunteer fire departments and other public services, even the abandonment of police functions by some municipalities. All of this might have been avoided if courts had acted with a little more common sense.