In theory, nothing is unnecessary, because everything in theory is unnecessary.
(j/k, of course; I love theory.)
More seriously, folks like you are the reason I phrased it "almost always." If you take the right "unnecessary" courses, it can help a lot. (So, are they really unnecessary then?)
My quantum mechanics class got me to think about the PL problem I was working on in terms of group theory. That turned out the be the key serendipitous insight that solved the problem.
But, I'm watching two students at two universities go down in flames right now because they're too distracted by taking lots of "fun" classes. They're like kids that locked themselves inside the candy store.