"The Lord of the Rings is of course a fundamentally religious and Catholic work; unconsciously so at first, but consciously in the revision. ” Letter to Robert Murray, S.J., 2 December 1953
By this, Tolkien meant that it was not meant to be a Christian allegory like Narnia (although technically Aslan was similarly meant to be "just" Jesus in an alternate universe and not an allegory for same, but much of the surrounding story was an allegory for C.S. Lewis' Christian apologetics, and Tolkien didn't care for that.)
But rather that he deliberately chose not to add in anything that would conflict, "metaphysically" with his Catholic beliefs about the nature of evil, the soul, creation etc.
Thus, if there is to be a Creator God, it had to be the same God that Tolkien believed in, with the author only as Sub-creator, inspired by the "reality" of creation in "real life" and thus inspired by the same source. (with the goal also of being realistic and not "alien" to the reader)
To that end, he made sure that the Valar were not separate deities but were similarly inspired, i.e. Sub-creators of their own, (c.f. the answer I gave here about Eru's relationship to the Ainur) and Tolkien created the concept of Mythopoeia to explain how he felt story-telling was the same way.
Melkor wanted to be a demi-urge and create his own separate realms uninspired by his own creator, which Tolkien and other Catholics would see as pride and rejecting the beauty of creation, conversely William Blake would have agreed but thought was a good thing.1
In short, a very broad application of "write what you know".
He also left out all references to religion in-universe precisely because he didn't want it to conflict with his own (or the reader's) thoughts on the matter, since it wasn't meant to be an alien world... Tolkien was a lot more broad in imagining, say, the fate of Elves and Dwarves after death and such, since they were mythical beings.
But he really fretted over stuff like whether Eru could allow inherently evil beings to exist, that conflicted with his theology etc. So basically unlike the movies where "it's just a story so let's pretend everyone's pure good or pure evil" Tolkien wanted to accurately reflect reality as he saw it.
On Edit: It helps that Tolkien was a Catholic as they're pretty syncretistic when it comes to associating prehistoric religious belief with "innocent belief" in Angels etc, so he could just fold it into his legendarium. The Jesuits often identified other creator gods with the Catholic God... And the Old Testament can get pretty out there too when it comes to pantheons of angelic beings.
1 William Blake probably would have sided with Melkor and the fallen angels. Similarly Fëanor rebelled against (the) God(s) in trying to "own" the light of creation.