According to Tolkien, my patootie. Tolkien never said our characters weren't there. Whether you're talking about the Battle of the Hornburg, or Moria (after the fellowship passed through). He simply didn't say it, didn't imply it, and (afaik) didn't intend it.
Look, JRRT was a smart guy. He built an incredibly complex and diverse world. There are literally MILLIONS of things going on in his world, only a very small fraction of which he can tell the story of. Did elves visit the Rohirrim? Sure, as proven by the fact that every Rohirrim who saw Legolas did NOT say, "what is that thing? it ain't human!" Same for dwarves. They had clearly seen elves and dwarves before. Elves and dwarves pass through Rohan. It's not a stretch to believe that there are people in Rohan who have FRIENDS who are elves and dwarves (just as there were people in the Shire, or Bree, or Rivendell, or name any other place who saw travelers of different races than themselves). Maybe one of those friends was visiting when Saruman's attack came, and the elf or dwarf helped their friend get to Helm's Deep. And ended up there with them. I don't think Tolkien would think twice before agreeing that perhaps this could have happened.
JRRT was painting with very broad strokes on his LotR canvas, except when it came to the story he set out to tell: that of the fellowship and their experiences. Just because he didn't say, "dear reader, there was a man named Angadan who--gasp--was not Rohirrim, and he took part in the battle too," that doesn't mean it didn't happen. Only that it didn't merit mention in the story Tolkien was trying to jam into less than 1,200 pages for publication.
Sorry, the world is more complex than even Tolkien described, and he's good with that. So I am, too. So should you be.
Dwarves and elves in Helm's Deep? No problem. A new dwarven expedition in Moria after the fellowship was there and gone? Okay, can live with that. Neither "break lore," they simply aren't mentioned there.
EDIT and PREEMPTIVE COUNTERSTRIKE: Before you say, "oh, you're one of those people who think it was cool that PJ added a company of elven archers to the battle, you're one of THOSE people"...nope, I'm not one of those. There is a qualitative difference between a few elves and dwarves here and there, not representing any other nation, and a company of troops sent by a neighboring political entity as a political gesture. The latter would certainly have been mentioned by Tolkien if it had occurred. Too big to leave out. Therefore, it IS lore-breaking. But...not a few scattered in here and there. Unless they're hobbits. Then break out the lore hammer.
