I think you are looking for exemplum. It is a story demonstrating a moral story and it can either be real or fictional. A real exemplum can be a founding myth or from actual history.
Exemplum is a rhetorical device that is defined as a short tale, narrative, or anecdote used in literary pieces and speeches to explain a doctrine or emphasize a moral point. They are generally in the forms of legends, folktales and fables.
The plural form of exemplum, also called exemplification, is exempla. Its subject matters are usually based on folktales, legends, fables and real life history; in which, a moral point is raised by emphasizing on the good or bad characteristics of a character. The moral teaching in exemplum comes at the beginning while a parable will have it at the end.
Another possible term is aition but it can also serve as the primary exemplum. Aition is a story that usually explains the origin of a religious observance.
In Western classical scholarship, the terms etiological myth and aition (from the Ancient Greek αἴτιον, "cause") are sometimes used for a myth that explains an origin, particularly how an object or custom came into existence.
A "founding myth" is the etiological myth (Greek aition) that explains the origins of a ritual or the founding of a city, the ethnogenesis of a group presented as a genealogy, with a founding father and thus of a nation (natio, "birth") or a narrative recounting the spiritual origins of a belief, philosophy, discipline, or idea. A founding myth may serve as the primary exemplum, as the myth of Ixion was the original example of a murderer rendered unclean by his crime, who needed cleansing (catharsis) of his impurity.