The original laws of this country did not permit lawsuits against government employees acting in an official capacity. After the Civil War, the Civil Right Act of 1871 was passed allowing citizens and residents to sue government officials for civil rights violations suffered under color of law. The qualified immunity doctrine was created by the courts after that to shield public officials from nuisance suits for discretionary actions (generally meaning bureaucratic actions) by people angry over actions that went against them (i.e., for denials of licenses, judgments, etc.).
Unfortunately, due to the volume of nuisance suits, this doctrine got stronger and stronger over time. At some point, the courts began applying this strengthened doctrine intended for bureaucratic actions to police actions.
But why shouldn't all people be protected from nuisance suits over reasonable mistakes?
Here I can’t sue mr Amash if I disagree with his bill, but I can sue him as a private citizen if he violates my civil rights as a person.
In the case of Federal Legislators, their immunity is written into the constitution explicitly.
No such explicit provision exists for government employees.