Come on, J.K., if you're going to start pulling rules out of your hat, at least show us the hat.
This is neither the first nor last time Harry was bailed out by a magical twist revealed after the fact, but I consider it one of the most blatant.
I don't want to derail the thread, but this is one of my huge pet peeves about the way JK wrote the series. There was no set of in-universe rules that had to be followed, which led to a lot of
deus ex machina endings. Nearly every book ended that way, too.
Book 1) You can't touch Harry's face or you'll melt.
Book 2) Don't worry, a Phoenix will show up and give you a sword!
Book 3) Time travel saved you in the future... in the past!
Book 4) Oh, by the way. You can't die. Sorry, we should have mentioned that earlier.
Book 5) Dumbledore to the rescue
Book 6) Instead of Malfoy doing his job, he pusses out and lets Snape do it
Book 7) This time, Harry can die, but its cool because he'll come back to life, but then comes the BIGGEST cop-out of the series: Voldemort essentially kills himself.
U're ah wizahd, 'Arry!
The end of book 7 was the one that pissed me off the most. I wanted to see Harry kill Voldemort, and because its a children's book she found a way to destroy Voldemort without Harry casting a single spell.
That being said, I loved the series, the above is just simple literary criticism.