Shelley, Poe, and Verne had the jump on Wells. Their works also had an element of social criticism. It's hard for any adult writing not to.
As I said, it's part of literature. Sci Fi filled that role as it came into existence, in part a result of science emerging as a thing in the 19th century, distinct from natural philosophy.