I'm writing from the viewpoint of someone who has been charged/attacked and a sidearm was needed to protect myself, very, very different than dispatching a few dogs.
My background is different than most as are my experiences, I'm just an average retired guy who lives in a very rural area on acreage, border county along the International Border. Before Arizona changed its law to requiring proper ID for employment, including businesses losing their business license upon second offense; there were a number of instances involving roving dog packs. Today, one can still hear sheep/goats bleating their painful death sounds that typically last for about 30-35 seconds.
I don't like killing animals, including hunting, one of those background things. You make excellent points on not knowing where or when a dog attack will happen, 30 miles per hour is about 45 feet per second...when "doggy" things go bad, they go bad in a flash.
One charge was a female pit bull that came out from mesquite brush at a full run as I was walking toward an on property pistol range. 1911s are popular here, the SO issues Colt 1911s in 45auto, as is 38Super...more popular on the other side of the Border. I often carry 1911s, havig trained, qualified and having history with the platform, both in 45 auto and the Super. In this instance, I was carrying a Colt 1911 in 38 Super, practice handload Zero 121gr, JHP ~1400fps...WSF powder IIRC, no exit from body. Of the times when I've needed to draw and shoot a 1911, I don't remember taking off the slide safety. One of the reasons for choosing 1911s is they are pointers and quick to first shot, in this case, one handed head shot, distance muzzle to head ~5 feet, DRT
The second and last charge to share, was a harrowing experience, one that vividly plays over in my head, involved 3 pit bulls surrounding a mutt terrier type. When the mutt began barking at a frenetic pace, it was obvious he was in a bad predicament. This not being my first rodeo, I drew a Colt 1911 in 45auto and it was in my hand as I went around home corner by the garage, the mutt was in the center of three pit bulls. Quickly, the center pit bull, growled, bared its fangs and hard charged. There was only enough time to partially bring the Colt up to engage, like the above encounter, no time for sights and I fired at the same time the right pit bull hit me in the groin area. Fortunately the muzzle blast caused the right pit bull to cease and run away.
It was a fatal, DRT hit through the center PB's left eye, major bleed out mouth and left ear. After determining the two surviving pit bulls had left the immediate area, I went back to where the center PB lay. Teeth were still bared, the 230gr Federal HST +P did what it was designed to do. Later on in time, upon examining the PB's skull, its jaw was totally broken and there were four cracks in the skull running from both its eye sockets to ear lobes. It was a heavy PB, the Mrs. thought at least 70lbs, it seemed like a ton as is it was dragged away from the house, buzzards and coyotes would have their feast.
Serveral things learned by these two, and others, was, no time for sights, one handed shots at very low angle engagements. Given a ~2ft distance between the muzzle and head on the second charge, the pit bull ran 10-12ft during the time it took me to raise an in hand 1911 to a ~30 degree hand angle shot. A serious and important mistake I made during the second example attack, my eyes forcused only on the center pit bull, excluding the right and left PBs. At the speed the second attack happened, I'm fairly certain a DA/SA pistol or DA revolver would have had the time to cycle and fire on target. This is someone who was issued .357mags back in the day. Without the first shot hit, three pit bulls at full speed would have engaged a guy in his 60s, life threatening injury or worse would have resulted.
I can't make a suggestion for platform or caliber, bullet choice design/construction being more important than caliber IMO. It's likely that some ammunition choices that meet FBI protocol will deflect off bone at very shallow angles.
Dog attack, for me, means an all out charge requiring DRT hits, best gun??? Many choices, strong side hip OWB, is fastest for one hand draw/shoot at very close distances. Back in the day, part of our POST quals, with .357mags was point shooting and from the hip, believe it is now called presentation.
Train wisely and use common sense, pit bull attacks on people are life changing events.