The Catholic Church teaches that [a]ccording to an ancient tradition, one can distinguish between two senses of Scripture: the literal and the spiritual, the latter being subdivided into the allegorical, moral and anagogical senses. [Cf. CCC 115]. The next point CCC 116 goes on to say that [t]he literal sense is the meaning conveyed by the words of Scripture and discovered by exegesis, following the rules of sound interpretation: "All other senses of Sacred Scripture are based on the literal." [St. Thomas Aquinas, STh I, 1, 10, ad I.]. Cf. also this @Geremia's answer.
Therefore according to the Church's rules for biblical interpretation, one always starts with the literal sense and all the other senses are based on it.
I haven't seen anything in Catholic circles that considers the 40 year trek in the wilderness [as] an allegory. Of course the Church considers the Old as a type of the New in which the Old is revealed and fulfilled. Cf. This answer for a Catholic understanding of the Temptation of Jesus in Mt 4:1-11 as contrasted with Israel: Matthew uses this episode of the temptations in the wilderness to depict Jesus as the new Israel, in contrast to the old. Jesus is tempted, as Moses and the chosen people were in their forty-year pilgrimage in the wilderness. The Israelite yielded to temptation [while Jesus did not]. [...]. And from this article Lesson Four: On the Way to the Promised Land | St. Paul Center in the section III. The Making of the Old Covenant B. Testing in the Wilderness:
Paul also said that we should read the account of Israel’s testing in
the wilderness "as an example…written down as a warning to us, upon
whom the end of the ages has come" (1 Corinthians 10:11).