He was also very clear that he was not writing allegory. Now, some people are not very clear on what allegory means. "Allegory" and "symbols" are not the same thing. Allegory is a type of symbolism, but there are a lot of ways of doing symbolism that aren't allegory ... and a lot of people are kind of fuzzy on that. The way allegory is most commonly used in literary and religious analysis is that there is a direct, almost 1:1 correspondence between the literary figure and what it is standing in for.
So, for example, Pilgrim's Progress is an allegory of Christian salvation. It's sort of a novel? There are characters who do stuff? but also they are very one-dimensional. The main character is a guy named Christian--yes, really!--who is journeying from his hometown ("the city of destruction") to the Celestial City (heaven). There is not much subtlety to it. It is pretty much what it is. There is no slippage, no playing around with the theme, no places where the symbolism is ambiguous. John Bunyan, the author, is hitting you over the head every step of the way with the Meaning That You Are Supposed To Be Getting From The Story.
Not all allegories are that crude or simplistic; the Narnia books are also allegory for Christianity. They have a lot more subtlety to them and a lot more nuance, and there's a lot of stuff in there that isn't allegorical, but on the crucial matters there is still a 1:1 correspondence. Aslan is Jesus. He's not like Jesus, he's not a character that has some similarities to Jesus or takes themes from the stories of Jesus, he is Jesus.
Tolkien is not doing allegory. Tolkien is taking the material of his life--his faith, his experiences in WWI, his linguistic and historical knowledge, his favorite books--and using them as the building blocks of his story. The themes and imagery and symbols draw heavily from all of that, the characters and settings draw heavily from all of that, but they are too complex to be allegorical. There's a lot of symbolism! It's not allegory.
So, for example, let's take the Dead Marshes referenced above. Does the experience of walking through this muddy wasteland with corpses all around that are rotting but still look like people draw from Tolkien's WWI battlefield experience of dead bodies in the trenches? Of course it does! but there are also a lot of differences. These dead are not from the current war, they are from a previous one--they are a reminder of old conflicts, of the ways the systems and powers of the current war have not come out of nowhere, there is history here. There is meaning that is not drawn from the Somme. And they are also drawing from literary references Tolkien was familiar with--primarily William Morris. Modern readers don't get the references because we have generally not read The House of the Wolflings, but that doesn't mean that the references aren't there.
So people read Tolkien's insistence that he didn't write allegory, and take that to mean that he's saying there isn't symbolic and thematic references. And that isn't what he meant! And also, we focus so much on the thematic references to WWI and Christianity, and we miss most of the other references, which makes it seem like Tolkien's only drawing on WWI, when he's actually doing something more complex.