I didn't even think about them killing essential npc's. That seems like a huge flaw in the game.
It really doesn't happen often, especially since you don't fast travel. I've had two dragon attacks in cities in over 1,000 hours of playing and both times I had fast travelled to the stable and entered the city right after: the dragon spawned outside but "followed" me inside the city like a NPC can follow you when you enter a building and he's talking to you.
They can happen in smaller settlements (Riverwood, Winterhold, etc.) but again, you not fast travelling will reduce the probability greatly.
EDIT: They don't kill essential NPCs, only non-essentials.