Funnily enough, for tabletop RPGs there's actually a good answer.
If you're familiar with the popular history of tabletop roleplaying games, you've probably heard the idea that they developed out of fantasy wargaming. That's not actually terribly accurate; tabletop RPGs and fantasy wargames are more like two parallel branches that split off from the recreating-historical-battles kind of wargaming at about the same time, and for the first couple of decades there wasn't a bright line drawn between them like there is today. Many are genuinely hard to classify by contemporary standards – there are a lot of early fantasy wargames that look more like modern tabletop RPGs, and vice versa.
One of the consequences of that lack of sharp distinctions between tabletop RPGs and fantasy wargames is that early tabletop RPGs were often played in a sort of "competitive co-op" format at wargaming tournaments. Multiple groups would run their parties through the same adventure in parallel, and be ranked on their performance; sometimes this would involve scoring points for completing specific objectives, or speedrunning the adventure and aiming for the fastest time, but the most popular tournament format was the survival module: adventures which were deliberately designed to be unreasonably difficult, with whichever group's last surviving character's corpse hit the ground furthest from the dungeon entrance being judged the winner.
The upshot of that popularity is that many published adventures early on – and certainly the greater part of the more infamous ones! – were originally written as survival modules, created to be run competitively at a particular tournament, and later repacked and sold as commercial products. Of course, practically none of them actually explained that; like nearly all tabletop RPG material of their day, they were written under the assumption that all tabletop roleplayers had come up through organised play at university gaming clubs, and thus already had all the context I've just outlined. This ended up causing no end of confusion when the hobby's mainstream visibility exploded in the early 1980s, and suddenly there were folks who'd picked up the rulebooks at their local bookstores trying to teach themselves how to play from first principles with no prior contact with gaming club culture.
As for why adventure games were also like that... well, this is going to sound bizarre by contemporary standards, and I don't blame you if you don't believe me, but once upon a time, point-and-click adventure games were considered the gold standard for Serious Gaming. Unforgiving routing, bizarre moon-logic puzzles, and a bewildering variety of unique ways to get yourself killed off were held up as the mark of the serious gamer in much the same way that janky soulslike combat systems are today, and a large chunk of the genre was made to cater to that ethos. Gamer culture is a hell of a drug!
(If you're about to ask the obvious follow-up question, "what changed?", the point-and-click adventure game's fall from grace and subsequent dismissal as casual fluff tracks more or less directly with a large demographic shift in the late 1990s that saw the genre's player base skewing predominantly female – and, well, you can probably connect the dots from there.)