This topic is very interesting...
The truth is that human beings mix all the elements that we have at our disposal. We already copied nature and now we do it with our own achievements. In the specific case of literature, it can be verified, through literary theory, that all types of stories are already classified (including tropes and archetypes, among other things, that influence). Thus, more than the what, what matters is the how (a story is told).
In the end, the barrier between inspiration and plagiarism will be determined by whoever pays (as it happens with the arts and with everything),that's why no one can imitate mickey mouse ears at all and then there are cheeks that just want to make easy money. Besides, copying is easy, but knowing how to copy is very, very complex. You only need to see the Terminator 2 movie (Bruno Mattei's, the Italian one) and the original. One was a complete success and another was a failure (cult, yes).
So, regardless of legal considerations, it's best not to "feel bad" and write as much as you can. If you have a minimum of self-esteem for your work and enough patience to do something decent, you will end up having your own style. I myself started with a fanfic and in the end I encouraged myself with a saga.
Greetings!