The word you're looking for is "fiction", and the moral of a story isn't diminished simply because the story is fictional. Parables, allegories, fables, myths, and fairy tales often contain truth despite not having actually happened. The opposite happens too, where the occasional real life anecdote is believed to contain some general truth despite being a one-off occurrence.