Is there a word that I can use to describe writing that explicitly tries to make us learn moral lessons which could be boring?
Didactic writing might be the term you are looking for.
Inclined to teach or moralize excessively.
(Literary & Literary Critical Terms) (of works of art or literature) containing a political or moral message to which aesthetic considerations are subordinated
Preaching is sometimes used for this:-
v.tr. 1. To proclaim or put forth in a sermon: preached the gospel. 2. To advocate, especially to urge acceptance of or compliance with: preached tolerance and peaceful coexistence. 3. To deliver (a sermon). v.intr. 1. To deliver a sermon. 2. To give religious or moral instruction, especially in a tedious manner.
(especially in the second sense of the intransitive).
One might also call it hectoring, to intimidate or harass by bluster or personal pressure, which is sometimes used for particularly forceful, patronising or repetitive preaching.
Such writing could be termed prescriptive, preachy or sermonic.
Pontificating is a favourite of mine. It implies that the speaker is taking a similar assumed moral stance to the Pontiff - i.e. the Pope.
How about a phrase? trite, facile sermonising
If somebody is teaching moral lessons to you patronizingly, they may be on their high horse.
The word is fable or proverb, but you might have to tack on an adjective to get the proper connotation of insufferable sanctimony.