I think Luke failed in the cave because Lucas/Kurtz/Kershner wanted to foreshadow the movie's ending. It salted the idea of Luke's general failure and the plot twist.
His failure is letting his emotions control him. "Only that what you take with you." Is what Yoda tells Luke. And Luke goes in the cave with his weapons, his fear, and his anger. And not surprisingly, he finds a fight. He fails on multiple levels. One being he fought an illusion. Had he been in control of his emotions, and not the other way around, he would have realized what he was seeing was an illusion.
The Force-message of ANH was "trust your feelings, Luke". In ESB it became "You're too reckless. Get some control over your emotions" which is virtually the opposite. In ROTJ Luke finally had enough seasoning and balance between the two.
As I understand it, feelings and emotions aren't the same thing. And the Jedi have both. It's negative emotions that must be brought under control, lest they control you.
"The Sith practice the dark side and are way out of balance. The Jedi aren't as much out of balance because they're the light side of the Force. They still have the bad side of the Force in them, but they keep it in check. It's always there, so it can always erupt if you let your guard down." - George Lucas
I'm not arguing that Luke "knew better" than Yoda. I'm arguing that Yoda might have tailored & abridged his teachings to fit who Luke was, and to fit the battle that Luke was facing.
I'm saying the Jedi were not entirely right in the PT. I'm saying they weren't firing on all cylinders. That's why Palpatine was able to wipe them out. I'd rather assign the blame for at least some bit of that failure on them because there is some logic to it and suits the tragic nature of that trilogy.
Tragic stories are not about characters doing everything right and the sky falls on them anyway. That's sheer pathos. Tragedies are about characters making mistakes for understandable reasons. If Palpatine wiped out the whole Jedi order while they did everything right, then it's more like Dark Helmet saying "Evil will always triumph because good is dumb." There's no blaming that one on Anakin, he had barely even turned dark by then. Palpatine just whupped the Jedis in Ep#3. Either the Jedis did something wrong or else the whole entire religion was no match for one bad guy. (Weren't they highly-respected good guys?)
I mean that's fair interpretation. But just as long as you understand that it's at odds with George's view. George is pretty clear, the Jedi didn't do anything wrong. Morally that is.
And it was more than just one guy. It was thousand year long plan of the Sith to undermine the Sith and destroy the Jedi.
As for the severity of Yoda's mistakes, I'm open to negotiation.
But Yoda did make mistakes. He let Anakin be trained (against his own instincts) in Ep#1.
The council voted that Anakin should be trained.
He failed to sense Palpatine rising to power.
"Victory? Victory you say? Master Obi-Wan, not victory. The shroud of the dark side has fallen. Impossible to see, the future is." - Yoda
The Jedi cannot see through the fog of the dark side. It's of no fault of their own. They literally find themselves unable to tap into the Force the way they used to.
He failed to take out Dooku at the end of Ep#2.
Because Yoda showed compassion and caring, and saved Obi-Wan and Anakin.
He failed to defeat Palpatine in Ep#3.
Again, the dark side was at its strongest during Episode III. And the Jedi can longer use the Force like they could.
The PT Yoda was not the flawless sage we got in 1980-83. He was more 3-dimensional and fallible.
George would say otherwise.
It was necessary for the whole PT story to work. If Palpatine was the evil Joker of the PT then Yoda was the closest thing to Batman. If your tragic storyline is that the Joker takes over Gotham then you have to explain why Batman didn't stop him. Batman has to fail in some way. If Batman did everything right and the Joker still won then we're back to Dark Helmet pathos.
The Jedi may have made some tactical blunders. But what predicated their fall wasn't loss of their moral compass. Or hubris or some such garbage like Dave suggests. It's blatantly contrary to what George says.