Dungeons and dragon's as actually almost all entirely culture mythoes and legend stuff. Mindflayers IE are not a copy-right idea. Final fantasy actually does this too, they even use mindflayers themselves, though they have a lot more iconic monsters and characters, like chocobos and moogles. But things like shiva and infrit are actually real religious idols of the indies.
Also, DND has almost no relation to lord of the rings. It's actually vastly more related to artistic interpretations of these mythos conceived from sword and sorcery themes, which is basically a mashup of gothic Europe, medieval Europe, nomad epics, and paganism from pretty much anywhere in the world, Africa, Europe, and indonasia .