I think the "illegal" is muddling things. Instead of saying that fanfic is illegal, another way to look at it is to say you do not have the right to create a derivative work of a copyrighted material. Whether you keep your fanfic to yourself or share it with the world, you have no right to create and you have no rights in your creation (fair use, permission, and public domain aside).
no subject