In my opinion, if it hapens unexpectedly, then it is DEM. if it is explained afterwards it still remains DEM, the only way, to get around it is to explain it before hand at which point I guess it ceases to be a problem of the unexplained and maybe, unless handled subtly enough (like I think your HP example is above) be ones contrived and stands out just as much.
This is something I very much look out for, and literally makes the difference bewteen something being bad and good in some cases, even (especially?) if its not a major plot point. I would prefer to have a single throw away comment on page 5 of book 1 about the baddy who doesn't come into play until page 126 of book three (extreme example perhaps). It shows really well thought out planning and attention to detail, which is really important for me. In fact I suggested something similar in a beta read I'm doing at the moment for exactly these reasons, avoids possible DEM, foreshadows well in advance in a subtle way and tells me that their world is full and real.
I understand that many people will take a differing view, and i will almost certainly world build myself into a corner because of it at some point in my career, but that's the way I like things