You are completely right. Pirate books are all over the place and they are so enduring: Daniel Defoe's Captain Singleton, Howard Pyle's Howard Pyle's Book of Pirates, Edgar Poe's The Gold Bug, Rafael Sabatini's many books, and Stevenson's Treasure Island, to name a few.
There are several reasons why pirates are fascinating.
First, pirates travel around the world. Part of the charm of these books is that they are exploratory. You can live vicariously through them and you get to see new land and peoples. And all their adventures are nothing less than amazing.
Second, pirates are daring. The fact that they brave the seas and seek the thrill of treasures is fun to read about and even to see on the silver screen (as evidenced in Johnny's Depp's success in the movies, Pirates of the Caribbean). Moreover, there is usually a chase. Who does not like a good chase?
Third, there is a comic element in pirate as well. The way they dress, their diction, and their persona are all odd to say the least. At times it is fearful, but at other times, it is amusing. Finally, I will add a link on pirate in popular culture.