It is obvious that both wars played a huge role in the development of artists as artists in that time, there's nothing "subtle" about it. How could they not? They were earth-shattering (both figuratively and literally) for everyone involved. That doesn't mean Middle-Earth or the events within it are "inspired by" any specific war or are somehow allegorical for any specific war. Tolkien himself denied this many times. If it was it wouldn't enjoy this enduring popularity, it would've died down as soon as the buzz around the wars did. It also doesn't mean that the war/s didn't shape him
as a person who could and was willing to write a thing like LotR, the first of its kind. LotR is a product of its time, however, there's a reason it wasn't written sooner by someone else, it's absolutely logical to have been written exactly then.
Anyway, I think it's disingenuous to say it took him "50 years" to write it, some of the ideas may have come then, but it wasn't any kind of complete concept or plan. He started manually writing it in '37 and completed it in '49. 12 years is a lot of time for a single project as well. He might've worked on the process/concept of
mythopoeia from 1917, but not LotR as LotR.