I don't think it's that complicated. Rather, I think that a lot of cops think they're in more danger than they really are. The vast, vast majority of people aren't going to gun them down for a traffic stop or for providing a warning about something. The situations where they're likely to get shot are exceedingly rare. By treating policing as some tremendously dangerous job we're completely ignoring the actual statistics, which show that firefighters and construction workers are far more routinely in physical danger.
The police then get carte blanche to walk around treating everyone like some dangerous creature ready to explode at the slightest provocation when most of us are just trying to get by and are pretty accepting of the benign law enforcement interactions we get.