From my perspective, the plots and outcomes of stories should originate from the constraints set up from outside the story setting. McCoy is a doctor, therefore not a line officer, and therefore any situation where he ends up in command has to arise naturally in-universe despite
the constraints. Those constraints would have to be highlighted and an explanation why a staff officer would end up in charge would have to be given. Breaking the rules to set up a dramatic situation might be done all the time, but that doesn't mean it's a good idea.
If McCoy can command a starship, despite having no experience and the character
having expressed no interest in doing so, then why not have Sulu do surgery, or have Scotty become a ballerina? Those would be interesting stories, too, but why tell them with those
characters? Neither Sulu nor Scott have shown interest in those areas. While anyone could write a story where they suddenly do show an interest, perhaps even an aptitude for the activity, why pull something so oddly out-of-character out of nowhere?
Maybe it comes down to whether a person prefers plot-driven stories or character-driven stories. From my perspective, putting McCoy in command would be a purely plot-driven contrivance that would violate the character's personality and history. Since I'm not convinced that McCoy could be a decent commander, I'm sure it would just weaken his character to see him fumble around trying to order other characters around. Further, I can't see him not handing command over to Spock, Scotty, Sulu, or even Chekov at the first opportunity.