This is a staple of the horror genre. Most authors will do a story like this at least once in their career; a small quiet town is afflicted by an ancient evil, ghosts, madness, a virus, vampirism, a dome, whatever.
It all boils down to the same thing.
Stephen King is the master of this. He has written so many of these, yet manages to make each one unique. Other good examples are Sarah Langan’s “Keeper” and “Virus”, Douglas Clegg’s “The Abandoned”, Nate Kenyon’s “Bloodstone”, Richard Laymon’s “One Rainy Night”, Brian Keene’s “Darkness on the Edge of Town”, Tim Curran’s “The Devil Next Door”. The list goes on and on.
It seems that this destruction of a microcosm is appealing to authors and readers alike in spite of it being a standard trope. It almost seems a right of passage into the horror genre. The format also lends itself to storytelling, covering multiple characters in the same town each experiencing the evil (in whatever shape that may be) in a different and very personal manner. These characters are from all walks of life and their actions have rippling effects with the other character’s storylines.
From this point of veiw it is the most fun for the author as they get to create new people to populate their imaginary town and new in sinister ways in which to express their twisted theme.
Speaking of theme, this is one of the horror tropes that smacks most heavily of allegory. The characters representing archetypes we see every day and the town itself the world in general. It is society on a manageable scale. Any bigger and it would lose the personal intimate sense of horror that is important in such stories.
That’s why these stories are a lot of fun to read. The author has something to say about humanity and/or our society and it’s right there for us to grab. More than many other tropes, this style of story holds the clearest yet often the darkest mirror up to ourselves, daring us to pear at the darkness within us all.