Can NPCs kill dragons? How to avoid it?
NPCs can kill dragons. But regardless of who kills a dragon (player character or otherwise), the dragon soul will always be absorbed by the player character (spoiler: except when you currently have a particular set of Dragonborn DLC quests active).
To add to this answer, you might also want to install the Run For Your Lives mod. It makes most NPCs hide indoors when there's a dragon attack, instead of facing them head-on and possibly getting killed by, or killing the dragon.
Mod description:
A small mod that makes citizens in a village or city run indoors during a dragon attack.
This was born out of frustration at seeing the citizens all trying to be a hero and rushing headlong to their doom attacking dragons. Instead, the citizens will run to safety like smart people should when faced with the horrors of giant flying fire breathing lizards. NPCs who live in the attack location who own a home there will retreat to it. If the attack location has an inn, NPCs who don't live there will flee to the inn, along with any NPCs who live outdoors. If no inn is present the game picks a random interior from the surrounding area and those NPCs will flee there instead.
This should work for any NPCs added by mods as well, up to a limit of 150 in the area. After that, they're on their own. The NPCs chosen are first come, first serve by the game engine.
Guards, members of The Companions, Vigilants of Stendaar, and the player's followers/teammates will not run, they will stand and fight. Farm animals will not run either, because they're stupid. That includes your horse.
Dragons are hostile to most NPCs, so yes, NPCs will kill dragons or die trying. You will absorb souls from nearby dead tragons regardless of who killed them. There is a bug with respawned dragons not giving soul some of the time, the cause of death of the original dragon is irrelevant; note that this bug has been fixed by the first version of Unofficial Skyrim Patch, which you would do well to use.