D&D and Middle-Earth have had a rather complex history. On the one hand, Gygax admitted to not enjoying Tolkien as much as more sword and sorcery-esque fare, and that certainly comes across in the more mercenary assumptions of early editions. At the same time, Gygax knew what was popular. Part of the motivation for Gygax’s original fantasy rules to Chainmail that gave Dave Arneson the seed that became the original Blackmoor campaign, which went on to spawn D&D once the feedback loop passed it through Gygax again, was a desire to pander to a desire to do Tolkienesque battles that had been percolating about in the wargame scene. The balors, treants and halflings of D&D were originally named as balrogs, ents, and hobbits until the Tolkien estate caughed and asked them to stop.
Following that, decades passed with no official meeting of D&D and Middle-Earth, despite some sort of Middle-Earth RPG existing for much of that time span. ICE’s MERP was based off Rolemaster, Decipher’s heavily movie-based Lord of the Rings RPG used their CODA system, and of course Cubicle 7’s The One Ring is a bespoke system made specifically for that game.
However, let it not be said that Cubicle 7 are blind to an opportunity. They have the Middle-Earth RPG licence, Wizards put out a pretty functional OGL for 5E, all the tools were there for them to make a legal, commercially viable Middle-Earth adaptation for D&D, so that’s exactly what they have done in the form of Adventures In Middle-Earth, the rules for which are presented in the Player’s Guide and Loremaster’s Guide.