Do we know why jokes are funny?
If so, why don't we have an algorithm that can write jokes?
I think you're right that we have some good descriptive models of humor, but we don't have any generative models of humor.
It's not hard to think of counter examples to this. Seeing a rival die isn't that funny. A child walking into a glass wall is pretty funny. The interesting question is how we can understand humor generally and fundamentally.
Jokes are funny because they relate a story of the transition of the object of laughter from potential threat, to non-threat. For example, a high status individual is a potential economic and social adversary and therefore a potential threat.
Consider: If someone slips on a banana peel it is only funny if it is a high status or would-be high status individual. If a handicapped child slipped on a banana peel it would only engender sympathy, not laughter. If a pompous or powerful and aggressive person slips on a banana peel it is funny because that person has instantly gone from the status of potential threat - someone to be reckoned with - to the status of non-threat.
Jokes, especially those with punch lines, follow a narrative thread where some person or persons make a sudden transition from high to low status, from threat to non-threat.