I think that usually, though, the rules are broken in the spirit of doing the right thing. The rules are usually restricting the protagonist, causing some good old warring emotions about doing what he/she is told vs. doing the things that will eventually make things right. It's a rite of passage, to use a cliche. Children have to learn to make their own decisions on their journey to adulthood - develop judgement and all that. It's usually made plain that the protagonist has good intentions and that their choice is to do the right thing, as opposed to blindly rebelling against authority, etc.
With that in mind, I disagree with the spin that devices like that teach kids to disrespect authority. IMO it's more about not following along with the rules if the rules don't make sense. However, I *do* think that it's artificial and not to be admired that the HP gang repeatedly goes behind the back of the profs - another important lesson (besides thinking on your own and deciding what's right vs. wrong) is to know when you need help. LOL the HP gang is lucky not to be mashed by Voldemort.