A well-known episode of Star Trek: the Next Generation, "Darmok," uses the concept of a race of aliens that eludes the Trek convention of a universal translator because they speak in metaphorical references to their history and mythology. Picard doesn't understand what they are talking about until the myth about uniting against a common foe is explained to him.
One way around the problem is what I'll call the Tékumel solution. In the original Empire of the Petal Throne game, the assumption was that the players start off as outland barbarians entering into Jakálla for the first time. The elaborate culture only had to be detailed in broad strokes; specifics would be learned later in the campaign. Generally this works by having an elaborate history that exists, but is not known by the players or their characters. But until a substantial amount of information is revealed to the players, references are not something we can rely upon as drivers for puzzles and clues.
A second solution is to set everything on a fantasy Earth. Lamentations of the Flame Princess has chosen this approach; the game is now set in 17th century Europe, leaving it ripe for reference to real-world literature, myth and superstition. This solution works, but sharply limits the amount of worldbuilding we are able to do. You get Earth and all the baggage that comes with it, good and bad.
None of this precludes having fantasy religion in the campaign as well. Real-world religions can be one pantheon among others, and it can also be incorporated in a way that's entirely appropriate to D&D: just like in the real-world middle ages, ancient paganism can be a thing of the distant past, that is nevertheless known as history to the characters. This is a good way of making it so that the PCs have about the same level of knowledge about your mythic references as the players do.
There are still challenges, such as the fact that the putative language the PCs are speaking is not really English and real English puns and jokes shouldn't work, but this is at least a framework I think can be useful for incorporating real-world mythology and creating puzzles, riddles, and other references that make sense to the players and their characters alike.