I think its pretty clear that to Lucas, the Jedi were the ultimate good guys, and that they are not inherently flawed, but do not always make the best decisions. The more flawed view of them comes from the EU.
"As the situation develops in the Clone Wars they are recruited into the army, and they become generals. They’re not generals. They don’t kill people. They don’t fight. They’re supposed to be ambassadors. There are a lot of Jedi that think that the Jedi sold out, that they should never have been in the army, but it’s a though call. It’s one of those conundrums, of which there’s a bunch of in my movies. You have to think it through. Are they going to stick by their moral rules and all be killed, which makes it irrelevant, or do they help save the Republic? They have good intentions, but they have been manipulated, which was their downfall.” — George Lucas
“The idea was to establish Jedi as what they were, which is sort of peacekeepers who moved through the galaxy to settle disputes. They aren’t policemen, they aren’t soldiers; they’re mafia dons. They come in and sit down with the two different sides and say, “Okay, now we’re going to settle this.”
A lot of people say, “What good is a lightsaber against a tank?” The Jedi weren’t meant to fight wars. That’s the big issue in the prequels. They got drafted into service, which is exactly what Palpatine wanted.” — George Lucas
When it comes to the Clone Wars, Lucas makes it clear in interviews that joining the war was not by their own will, but out of necessity to try to keep as much good and order as possible. They’ve also been drafted he says, and forced to fight, which aligns with the Vietnam draft that occurred during Lucas’ own youth.
As for their rules and beliefs? Lucas never intended for them to be wrong about anything like that, especially attachment. Lucas considers himself a Buddhist Methodist, and used Zen Buddhist Monks and their philosophies as the fundamental basis for the Jedi Order. One of those major ideas is forgoing attachments, which does not really mean the same in the Buddhist tradition as it means in the West.
“The message [of Attack of the Clones] is you can’t possess things. You can’t hold on to them. You have to accept change. You have to accept the fact that things transition. And so, as you try to hold on to things or you become afraid of – that you’re going to lose things, then you begin to crave the power to control those things. And then, you start to become greedy and then you turn into a bad person.” — George Lucas
“The fact that everything must change and that things come and go through his life and that [Anakin] cannot hold onto things, which is a basic Jedi philosophy that he isn’t willing to accept emotionally and the reason that is because he was raised by his mother rather than the Jedi. If he’d have been taken in his first years and started to study to be a Jedi, he wouldn’t have this particular connection as strong as it is and he’d have been trained to love people but not to become attached to them.
“But he become attached to his mother and he will become attached to Padme and these things are, for a Jedi, who needs to have a clear mind and not be influenced by threats to their attachments, a dangerous situation. And it feeds into fear of losing things, which feeds into greed, wanting to keep things, wanting to keep his possessions and things that he should be letting go of. His fear of losing her turns to anger at losing her, which ultimately turns to revenge in wiping out the village. The scene with the Tusken Raiders is the first scene that ultimately takes him on the road to the dark side. I mean he’s been prepping for this, but that’s the one where he’s sort of doing something that is completely inappropriate.
“He’s greedy in that he wants to keep his mother around, he’s greedy in that he wants to become more powerful in order to control things in order to keep the things around that he wants. There’s a lot of connections here with the beginning of him sliding into the dark side. [….]
“Because of that, and because he was unwilling to let go of his mother, because he was so attached to her, he committed this terrible revenge on the Tusken Raiders.” — George Lucas
“The Jedi are trained to let go. They’re trained from birth,” he continues, “They’re not supposed to form attachments. They can love people- in fact, they should love everybody. They should love their enemies; they should love the Sith. But they can’t form attachments.” — George Lucas
“The thing with Anakin is that he started out a great kid he was very compassionate, so the issue was how did he turn bad. How did he go to the dark side? He went to the dark side, Jedi aren’t supposed to have attachments. They can love people, they can do that, but they can’t attach, that’s the problem in the world of fear. Once you are attached to something then you become afraid of losing it. And when you become afraid of losing it, then you turn to the dark side, and you want to hold onto it, and that was Anakin’s issue. Ultimately, that he wanted to hold onto his wife who he knew, he had a premonition that she was going to die, he didn’t know how to stop it, so he went to the dark side. In mythology you go to Hades, and you talk to the devil, and the devil says ‘this is what you do’ and basically you sell your soul to the devil. When you do that, and you’re afraid and you’re on the dark side and you fall off the golden path of compassion because you are greedy, you want to hold on to something that you love and he didn’t do the right thing and as a result he turned bad.” — George Lucas
“The fact that everything must change and that things come and go through his life and that he can’t hold onto things, which is a basic Jedi philosophy that he isn’t willing to accept emotionally and the reason that is because he was raised by his mother rather than the Jedi. If he’d have been taken in his first year and started to study to be a Jedi, he wouldn’t have this particular connection as strong as it is and he’d have been trained to love people but not to become attached to them." — George Lucas
Now, whether Lucas did a good job conveying these ideas, or whether one agrees with these ideas, is another debate altogether. I do not believe that Lucas meant the Jedi to be seen as a flawed institution, though they sometimes made mistakes, and many Jedi were prone to arrogance just like any other person. Again, whether he did a good job conveying these ideas is up to debate, and though I like what Lucas was going for, I think it could certainly have been brought out better within the films themselves.
EU authors like Karen Traviss for example, were the ones that really started the idea that the Jedi Order was inherently flawed within official (albeit EU) stories. I’ve seen authors like John Jackson Miller, Karen Miller, and others continue with these ideas, though not as critically. Dave Filoni also has his famous analysis of The Phantom Menace, which I have always viewed as him seeing what he wanted to see with the prequels, and him interpreting them his own way. To make it clear: this is perfectly fine, I’m not arguing against it at all and again I see validity to it since the prequels leave a lot open to interpretation as any good art should. But when we are talking about what Lucas himself intended, and how he views the Jedi, I think its very important to make this distinction.