You’re assuming that the cops percieve you as a threat and are guaranteed to kill you no matter what you do. I won’t deny that’s happened but its very far from the norm. In a lot of cases the cops are stupid, or negligent or scared and prematurely react without foresight. Add a civillian possessing a gun and and flagrantly threatening to use it and you turn a situation that could be disarmed into a inevitable violent conflict.
It’s amazing how almost every job not in the government already acknowledges and penalises this as a crime. But because these folks actually instate the rules they have to follow their somehow exempt from the same standards.