This sort of thread is why I love coming here - a sensible question (that’s maybe out-of-the-ordinary, a little bit), and really thought-provoking about some little aspect of the way many of us might live our lives, and might not normally think about much at all! So thank you to joyfulcross2288 for starting this conversation!
From my point of view, I guess you have to distinguish between what’s sinful or not, and what is illegal or not. It would be both illegal and sinful to use someone’s ideas without any acknowledgement (and especially if you intend to profit from it). I would suggest that fanfiction can’t really be seen as sinful, as long as it is clear (and if it’s something ‘big’ like Harry Potter etc then it would be abundantly clear the original idea or setting wouldn’t be your own work anyway I suppose!), that one is building on the work of someone else: that’s not stealing anything - you’re adapting, improving (possibly!), and also showing your own appreciation and enjoyment of the original author’s work. Just writing for your own enjoyment and maybe others (to host on some fanfic website, for instance), shouldn’t be a problem (of course it is sometimes, but that’s what I mean by the sinful/illegal difference).
Of course, even within such “fair use” guidelines, one could get into a heap of trouble especially by trying to profit from it. For works out of copyright like MonikaBarbara’s Pride and Prejudice novel (let us know when/if it’s written, by the way!!), it’s probably easier than trying, say, to write and publish a book set in the Harry Potter universe - even if general permission to write fan fiction has been granted by the author.
That said, it’s clearly not impossible. There are authors who make their entire living writing and publishing Star Trek fan-fiction, (other sci-fi series are available…), after all. As long as permission is sought from the copyright holder, it shouldn’t be a problem at all.