Ok this is pretty easy I have faced this issue quite often with vampires and dragons alike attacking small holds and big holds. In numerous times i have encountered situations where dragons killed npc's and vampires killed them and summoned them as throlls, i hate losing npc's because...
1: some are usefull for trading/selling merchandise and making big bucks ( i currently have 900k plus in septims, nearly reaching one million now, by exploiting the crown of barenziah perk which allows u to find more gems in every chest and urns and also by creating potions in large amounts and selling them in every city, town, stronghold, merchant etc.
2: towns empty of npc's make it look like a ghost town, and i hate that, i love interaction and a vivid town filled with people walking around. Currently after the stormcloak attack in whiterun i've noticed that the battle born family only leaves their home if i go inside of it ( still has to be further tested ) but it seems that the reason they dont leave the house too often is because the stormcloaks blame them for treachery and siding with the empire so without idolaf battle born who i killed because he was being a jerk to me because i said i was siding with clan gray mane and without the rest of the battle born family walking around because they feel threatened by the stormcloak guards, whiterun deffenetly seems emptier yet it's only one man shorter.
As far as dragons they seem to attack mostly small holds like riverwood, falkreath, dawnstar, orc strongholds, college of winterhold etc, open areas, if that's the case, as soon as u hear a dragon approach, run the fluff away from the village and hope that they will follow u, if that doesnt work re-load to a previous auto-save ( if u have auto-save after every exit and entry in places on ) and then plan ur approach to that location, fast travel to a location nearby that town and wait for the dragon to show up he will most likely show up even after u re-loaded and fast travel there again, BUT if u fast travel to a nearby location to the town where u wanna go to he will spawn around flying nearby where you're at, wait for him to land next to u or fight other enemies ( bandits or animals depends where you're at ) and take him on there. Dragons are tricky creatures so re-load, fast travel to nearby locations and ttake them out there.
Vampires are a new experience to me because i only recently installed all of the 3 dlc's to skyrim and am currently gonna start playing dawnguard for the first time, but with a level 97 character i've had my own share of vampire attacks, the way i proceeded is diferent however, if i see them killing npc's or using them i just reload to a previous save before they atack, also on a positive note, vampires only attack at night which means most npc's are sleeping however from time to time u may fast travel to a time where they start spawning like let's say 7pm 8pm ish and by that time npc's are either still finishing their chores and are going home or are just aimelessly walking around with nothing to do, in those situations u have to protect the, if that fails re-load again, also vampires tend to come by packs of 3, two throlls, and one master vampire or a master vampire with two hounds, and they always always always arrive by the main gate, except in markarth where they show up from the smelter and blacksmith side of the city. If you and the guards can kill them before they kill any npc's good, but always make sure u look around the general area where the attack took place and see if there are any bodies laying around.
You have to be tenacious cautious and smart to avoid them from killing people, it's true npc's do tend to attack vampires and dragons and end up killing themselvs, so reload try again, try fast travelling at night or to a nearby location if it's dragons, and if it's vampires just watch the main gate behind u and see if any spawns, kill them mercilessly as quick as possible with your best weapon, what i found intriguing is that vampires are weak to fire spells and fire enchantment, use that to eliminate them quickly enough, and bring a follower with u, they do wonders to cast the attention of the vampires on them and urself instead of npc's.