There are too many ways to do this I’m going to multiple lists. First, I’ll try Dave’s idea of multiple genres. I’m not a big sci-fi fan, but Warriors of the Red Planet would give me exactly what I want from that genre in one slim little volume. For horror, I’d pick the sixth edition of Call of Cthulhu because it’s in one volume (and it's the one I own) and benefits from the advancements made over several editions while still hewing closely to the original vibe. For something more exotic, Empire of the Petal Throne is perfect for its complete world that's intriguing and mysterious. (I just realized that Geoffrey McKinney’s Carcosa falls at an intersection of all three of these games.) For something to fill the D&D slot, I’ll pick the Holmes Basic box set – either the first printing with the geomorphs and the monster & treasure assortment, or the next one with B1. It may only go up to level 3, but you would be free to extrapolate the rest as you saw fit, and in terms of a ruleset that really totemically gets to the core of the D&D vibe, it’s hard to beat. I’m not really big into superhero games or cyberpunk, so I don’t really have a fifth pick. I guess I’ll choose MERP for nostalgic reasons.
Another way to look at this is to pick setting books, modules, and toolkits instead of an actual game system. Once you’ve played TTRPGs for long enough, it’s easy enough to pick a core mechanic and make up your own system. Many of us can play D&D without the rulebooks by now, so perhaps the best bet would be to bring something with lots of random tables to help generate an infinite amount of adventure. The danger with just picking modules is that it’s an endless trap. Picking five modules to run forever is pretty limited, no matter how sandbox-y they are. There are about five really good megadungeons out there which would keep you busy until the end of time, but it would get a little same-y after a while. Campaign settings can be really good and open (various 2e AD&D, Dolmenwood, and Midderlands), but their specificity doesn't always give you the latitudes you might like.
As far as toolkits go, books like Veins of the Earth can give you procedures to build your own campaign world, but you need to choose them wisely to give you a breadth of settings. You could choose something like the Fight On! compendium of Vol. 1-4, John’s Stater’s NOD or Hex Crawl Chronicles, or James V. West’s Black Pudding collection which are all filled with great ideas. The Judges Guild really perfected this kind of variable setting supplements with their Ready Ref Sheets, City State of the Invincible Overlord, Wilderlands of High Fantasy, Dave Arneson’s First Fantasy Campaign, and any of their early modules (Tegel Manor, Caverns of Thracia, Dark Tower, or Citadel of Fire). You could do a lot worse than just picking five things from the early JG stuff.
In terms of something self-contained, any of the OSR retroclones would really do the trick. Basic Fantasy, Swords & Wizardry, Labyrinth Lord, Delving Deeper, OSRIC, DCC, Lamentations of the Flame Princess, Blueholme, and many others give you everything you need in one book. In all honesty, one of these games is all I would need. Whatever you wanted to change you could house rule into your own system and in a lot of cases the clones are easier to run than the original games because of some of their modern innovations. However, these kinds of desert island questions aren’t just about practical usefulness. It’s about inspiration too, and that doesn’t always match what’s pragmatic. Sometimes it’s about what brings you joy, even if that comes from a place of nostalgia and sentimental attachment.
To speak to that, although it would be nice to have a breadth of systems or genres, in the end, I really just want to play some form of D&D. It’s my first love in this hobby and what I’d choose over anything else. If I was going to Frankenstein a nice feel-good collection of five D&D products, I suppose I would pick the Moldvay Basic set (with B2 Keep on the Borderlands), the Cook/Marsh Expert set (with X1 Isle of Dread), the 1e AD&D Dungeon Masters Guide by Gary Gygax, the 1e AD&D Monster Manual, and the original edition’s Gods, Demi-Gods & Heroes (the original, unedited version, not the incomplete WotC resissue). Even though these five span three different editions of the game (0e, 1e, and B/X), this is D&D to me. I’m one of those people who feel all TTRPGs in some way are just house-ruled versions of the original (this drives people nuts, sorry).
In that spirit, maybe the best choice of all would be the original game and its four supplements: the white box (with the 3 LBBs), Greyhawk, Blackmoor, Eldritch Wizardry, and Gods, Demi-Gods & Heroes. You can extrapolate everything from these five, and in fact, we as gamers have over the last 40-some years. What are yours?