Video games are probably closest to books; in fact, much of software is probably "bookish" in general - lots of it written for particular purposes, sells well enough to have been done, disappears into the long-tail.
A few major breakout successes become historical and bought long after the fact, but the majority do not.
Most books almost certainly lose money for the publisher. It's more complicated from the author's perspective given that people write books for a variety of motivations but, certainly, most books are doing well to earn out their advance which can easily be only $1,000 or so.
But, as you say, even those that sell "well enough" initially fall off pretty quickly. And some sorts of titles such as non-fiction about current tech stacks or software versions have a very limited shelf life.
A few major breakout successes become historical and bought long after the fact, but the majority do not.