The joke also holds meaning, thematically. Luke tells Rey that the legacy of the Jedi is failure. Despite this rather cynical assessment, it is heavily implied in RotS and especially The Clone Wars that the Jedi fell because they lost their way. The Jedi texts symbolize that failure because part of the problem was that the Jedi had become too rigid and dogmatic in their thinking; they had lost touch with the Force and were relying on tradition instead. They were essentially blind, which is why Palpatine was able to scheme behind their backs.
Luke’s instinct is to destroy the texts, and Yoda confirms that this instinct is correct. The texts were dry and boring and what really matters is the Force itself, because it alone will guide you. Rey needs to look forward, not backward, if she is to succeed. It is a powerful lesson and NOT MCU-style humor at all.
On a similar note, Luke tossing the lightsaber over his shoulder basically represents the same theme. Luke is done with the Jedi Order. Tossing the lightsaber was intended to startle the viewer and make a strong impression, not make them laugh. The viewer is left flabbergasted, simply asking why he would do such a thing. But again, this is merely a continuation of themes brought forth in RotS, which I predict will extend into TRoS.