So this is a thing that I've started to contemplate while discussing fanfic peeves and whatnot with tanithryudo. I am of the belief that fanfic's job is not to slavishly follow canon, but rather to transform canon into something new. But why is it that when certain elements get altered it feels completely fine while other elements feel like it violated fanfic expectations?
I'm not sure I have a real answer, but I think it might come down to what the reader perceives as flavor vs framework in a story.
Flavor is, vaguely, elements to the canon world building that don't fundamentally alter the plot. Framework, on the other hand, are elements that are so woven into the story's plot advancement/character development that altering it would require extensive re-writing for the story to keep its internal logic consistent.
I will try to demonstrate this via a fantasy comparison and a sci-fi comparison. Note this is not some kind of absolute categorization nor is it a universally agreed upon mechanism. This is merely my shallow attempt at explaining why certain fanfic succeed at transforming the canon while others fail from my perspective.
( Aka, not all AUs are bad, but most of them are. )
Now, as a reader of slash fic/BL fic, I've become quite comfortable with accepting a wide, wide amount of deviation from canon. I will defend deviation and transformation of canon to the end, but I do think it's important to identify what parts of canon is being changed and whether that change affects flavor or framework. Correctly identifying the nature of the change and addressing the effect of that change is what makes transformative works fun. Failing to correctly identify the nature of the change and simply slapping a plot into a setting results in fics that, at least for me, no longer feel like fanfic.
At that point, one really is better off just writing original fic.