There seem to me to be strong parallels between what people do with characters in fanfiction and what children do with their toys, particularly when it comes to toys which are part of a TV or book or film tie-in (e.g. He-Man, or Star Wars).
In both cases, one is taking 'existing' characters and creating new adventures for them; and those adventures can be near or far from canon (Luke Skywalker fights Darth Vader or Luke Skywalker fights a dragon).
Also, each child creates their own understanding of the character: informed by the original source and by how their friends play with that character but also strongly influenced by their own perception of the world.
Moreover, just as children use toys to explore and replay situations they've encountered in real life to aid their understanding; so I think a lot of fanfiction writers use writing almost as a form of therapy - a way of expressing and exploring their own feelings, insecurities, and relationship worries at a 'safe distance' (non-fanfiction writers do this as well of course, but it's easier to see in fanfiction because you have many different writers all 'animating' the same characters in different ways).
I also think there is probably a fair amount of the equivalent of making toys kiss and lie on top of one another amongst some younger and sexually inexperienced writers; they can explore their own feelings about sex by making two characters do it. And where the writer is female, and the two protagonists are male, it provides an extra layer of safety - an extra layer of separation between what her characters are doing and saying and the fact that she is actually writing her own thoughts and feelings.
This would also explain the popularity of the mpreg (male pregnancy) subgenre - essentially it's just a way of playing mummies and daddies.
Mary-Sue-ism (where the story features an idealised version of the writer) could be perceived as a more naive version of this and I think it's telling that it's most prevalent amongst the least mature writers. I know that I was 11 before I started to grasp the idea of telling stories that didn't simply involve me and my friends going off and having adventures, and I was probably fairly mature for my age.
The theory also ties in well with the cognitive dissonance I sometimes experience at the idea of certain pairings (or slash at all in certain fandoms). To me at least it feels very much like the sense of betrayal I used to feel when people 'didn't play properly' with my favourite toys - making them behave in ways I instinctively 'knew' were out of character.
I don't have a conclusion here: it just struck me as an interesting way of looking at the phenomenon.
Disclaimer: I'm not saying this is what all fanfiction writers are doing, or at least if they are, they are only doing it inasmuch as writers of any sort do. I'm just saying it's a tendency which exists and can be used to explain some things.