Creating virtuous characters who are not boring is one of the greatest challenges a writer faces. Villains are so much more fun, and most regular heroes and heroines are just middling good. To have a central figure who consistently struggles with moral questions without turning him/her into a prig is not an easy task. Trollope could do it, so could Tolkien and Marilyne Robinson, but I suspect they struggled with the same issues in their personal lives that their characters do in their fiction. Most of us are fortunately exempt from deep moral challenges.
MacDonald was an ordained minister who was constantly at odds with the leaders of his denomination because he refused to adhere to their rigid ideas of right and wrong. He turned to writing to support his family and to give voice to his opinions about what constitutes moral behavior. He isn't above a little preaching in his novels, but it is not offensive. He was a major influence on C S Lewis, who acknowledges MacDonald as his 'master.' This need to communicate moral values doesn't stop MacDonald from writing some ripping good stories, and his two fantasy novels Phantastes and Lilith are classic forerunners of the genre. His children's stories are fun, too. I have a copy of The Light Princess illustrated by Maurice Sendak that is a delight. The Golden Key, The Princess and the Goblin, and the Princess and Curdie are light-handed accounts of the moral questions that children (and adults) face every day. Try to avoid the bowdlerized versions of his Scottish stories. The Scots dialect is a treat to read, and the digressions are the best part. The versions where the dialect as been eliminated, and the stories condensed are abominations IMHO.
This book isn't one of his best, but even his lesser works are worth the time to read them.