Sure, in a different context it may be a necessary condition, if you consider all other variables immutable. But there's no need to do that. Many variables can be changed, including the legal system.
I think if you observe that your legal system is so janky that you can only have a functioning police force by making police officers selectively immune to the law, your response should be to not accept such a kludge and insist on actually reforming your legal system.
What we want is for the police to behave better.
The mechanism is increased legal liability. That is, both the fear and effects off law suits.
Presumably, law suits would have to rise, especially at first, for this to work because I’m pretty sure the fear of increased legal liability alone will not change police behavior significantly. They will need to feel the teeth of this.