@jmi one definitely was written in response to the other.
That's not even the only Macbeth reference in LOTR! "Till Birnam wood remove to Dunsinane". Shakespeare's answer: an army cuts down the forest and uses it for camouflage. Tolkien's answer: THE ENTS: TREE-MEN THAT WALK!