What was the original fanfiction? If you look this up, as I did, you'd find that most date it to the 1960s when Star Trek fans penned their own tales about the characters onboard the Enterprise. This was, of course, pre-internet, so these stories were shared via actual publication.
A few article on fanfiction claim that the genre (yes, many would count it as that) predates the world of television. They would claim that references and reimaginings of pre-existing stories can fall under that umbrella term and so count works of literature like Dante's Inferno and Milton's Paradise Lost as fanfiction for the Bible. Some even contend that Shakespeare's plays are fanfiction because they rework stories that were invented earlier.
I don't quite buy that broad definition of the term. I'd possibly grant that Sherlock Holmes stories by authors other than Arthur Conan Doyle could rank as fanfiction in depicting a recognized character that someone else had invented in new stories, though I wouldn't say that any work of literature that is infulenced by common stories and myths can be considered fanfiction.
What's the key differentiator here? I think it may really need to start on the basis of deep interest in a character they did not first create. But would that character have to originated in fiction for fanfiction? I think not.
On that basis, I'd content that Brontë's juvenilia constitutes fanfiction -- a term I wasn't familiar with back in the day when I wrote my dissertation. Her depictions of the Duke of Wellington that evolved into the Duke of Zamorna and then the king of Angria really was a Victorian forerunner of modern fanfiction.
Much in the way fanfiction writers take their inspiration from television characters, Brontë looked to the celebrity figure of her day and cast him in new adventures and then her own world. Whereas Louisa May Alcott was able to profit from her overwrought tales that did sell, Brontë's were not meant for publication.