I think when they choose to pull the weapon out it is to stop a threat and it is not unusual to empty the whole clip to make sure the threat doesn’t prevent them from going home to their family.
Not a popular view with some, but it does make sense and the way it is.
I think the text book answer to the question of why did you fire that many rounds is: I shot to stop him from doing what it was that caused me to shoot in the first place.