One interesting thing that offers clues as to why he wrote this book is the way Dickens plays with names; specifically as it applies to Miss Havisham. Miss Havisham was one of the main antagonists of the novel and she was also quite wealthy. We can see how her name when pronounced out loud sounds a lot like "have a sham" or "have a shame", which offers ridicule and criticism towards the wealthy. We also see how the characterization of Miss Havisham offers even more ridicule towards the wealthy, as Dickens describes her to look like a witch (associating her again with evil in the process).
Helena Bonham Carter as Miss Havisham in Mike Newell's 2012 film adaptation of Great Expectations.
We can see her witchly appearance portrayed. Does this wealthy lady look good or evil? Charles Dickens felt strongly about the wealthy.