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.
I don't mind the occasional protagonist who makes their own trouble. I agree it would be annoying if all protagonists were like that (and I agree that Harry is annoying in general), there's room in the world for stories like this.
Now that you mention it, your first example does sound like a Deus Ex Machina. Except that
the story already established that the simplest possible time loop is preferred, and it's entirely possible that if Harry hadn't gotten out to pass a note, someone would have gone back in time to investigate his death, and inadvertently caused a paradox by unlocking the door.
This wouldn't have had to be a long explanation or full-blown lecture, just enough to confirm this interpretation. But since it wasn't confirmed and there are multiple valid interpretations of the mechanics, it does come across as a bit of an "I got out of jail free" moment.
I... don't understand your second example. I think that part of the story works just fine. Harry's solution was plausible, and even foreshadowed
in chapter 28 when he used transfiguration to apply force.
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?