It goes along with Sanderson’s Laws of Magic, specifically rule 1:
An author’s ability to solve conflict with magic is DIRECTLY PROPORTIONAL to how well the reader understands said magic.
It works for HP because it’s targeting kids, but adults get frustrated because Rowling just makes up stuff each book. For example, why are port keys not a thing before book 4? (it would be a lot easier to take a portkey to Hogwarts than a train) Because they’re a plot device at the end of book 4, and almost never used again.
Rowling uses magic way too much to solve problems in HP and she does so inconsistently, but that’s totally fine because the point of the story is to appeal to kids and inspire imagination (and kids love quick solutions to problems), not to appeal to adults.
Really interesting concept you brought up, did not know that law and yes it makes perfect sense.
And I totally get your point, but it is still an issue to me considering that she wanted to keep the audience hooked as they aged. As someone put it in another comment, in the first book, Harry is eleven, it appeals to kids ~11 y.o, and so on. But, and I speak personnaly, by the fifth book it was already too disjointed for 15 y.o. me. Her books are like a Jojo’s Bizarre Adventure book/episode, but without all the corny humor and the self-awarness that makes it fun.
Idk, my oldest kid is 10 and has finished the whole series. She may have intended kids to grow with the series, and that was certainly true when they came out (I remember my cousin reading the books as they came out), but I do think they have limited appeal to more mature audiences.
That said, I do still read YA novels, and I’m definitely not the audience, so I’m sure there are plenty of older kids and adults who aren’t as bothered by plot holes and whatnot.