The Three Musketeers is a historical novel. While this may sound as though it is a dry portrayal of political events from the 17th century, it is anything but stale. The genre of the historical novel boomed in popularity in the first half of the 19th century, especially following Walter Scott's bestselling Waverley novels. Books in this genre were set in the past and featured characters based on real political figures, but they aimed to tell exciting, fictionalized stories about those characters and the events in which they were involved.
In fact, many historical novels are also classified as "romances" because they have over-the-top, highly dramatic plots that prioritize adventure and excitement over historical "accuracy." The Three Musketeers, likewise, takes many liberties with history in order to tell a good story. For instance, the long series of conflicts between France and England during the 17th century had more to do with power, politics, and religion than with the personal love affairs of the political rulers involved. Dumas writes an account in which the entire world stage is directed by the love, infidelity, and jealousy of kings, queens, and dukes.
In fact, Dumas's historical romance is even more focused on adventure and excitement than some of the earlier historical romances. The prime example of a "swashbuckling" romance, The Three Musketeers indulges in gratuitous violence, seduction plots, revenge plots, and highly gendered stereotypes (such as the damsel in distress and the evil, conniving woman), all to create a fun, page-turning reading experience. Many historical novelists use romance to make an overarching and well-thought-out point about history. Swashbucklers, on the other hand, are often more likely to use history as a backdrop for a fun story. It is possible to analyze them and find connections with social and political questions from the author's day, but they tend to be primarily plot-driven.
The Three Musketeers certainly makes a few points about politics but is first and foremost an adventure story. These exciting books, which attracted a lot of readers (and therefore buyers) became more common over the course of the 19th century. They often appeared in installments in newspapers, especially in Europe, and were one of the trends that established fiction writing as a viable profession.