Wells knew the dangers of communism, even though he was fascinated by it, as Men Like Gods shows.
The Time Machine itself is an allegory - an idyllic society of the top few (the Eloi) built on the backs of the masses (the Morlocks). Even the Morlocks eating the odd Eloi is predicative - when the masses get restless, one of the upper class must be sacrificed to appease them. It's easy to forget Wells was well versed in science and mob psychology.
He was hopeful that communism would take hold and did consider it the future of mankind, yet most of his writings are about the pitfalls and how to avoid them.