There is one thing that really striked me after reading HPMOR, it’s a certain pattern of events that repeats many times.
1) Harry gets into grave trouble due to his self-assurance and indiscretion
2) The author saves Harry using deus ex machina
And this makes me wonder—was Harry intentionally shown as an anti-example of rationality, or it just happened this way?
Chapter 122, paragraph beginning with “And right now, Harry James Potter-Evans-Verres was still a walking catastrophe”… and the stuff immediately preceding and following it. Seems like a pretty direct answer to your question.
Yes, but wasn’t he supposed to learn on his mistakes rather than rely on miracles to save him?
That’s what the end of the book is about.
The end of the book looks like Harry’s worst case of self-assurance and indiscretion to me.