I think a large amount of the danger American police face is due to how easily a single arrest can ruin your productive life. One facing the loss of their home, pets, job, important documents, sentimental items might not see the difference between losing everything, and losing everything and taking the guy who's taking it from you, with you.
If we had an actual system based on reform rather than punishment, I think the danger police would be in would be greatly reduced.
You also have things like qualified immunity and general protections for police against being sued for an unlawful arrest. An officer can incorrectly arrest you and you could lose everything and be simply shit out of luck.
If there's no repercussions for bad cops, there's no justice. If there's no justice, why would one play nicely with the law, therefore police are in danger.