This is also true of the original Top Gun, released ~37 years ago. Very little software has that kind of long-term earning power, further supporting the idea that software work is not all that unique as work goes.
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.
An actor usually spends a few weeks working on a movie and then the studio profits in perpetuity off that work. Tom Cruise finished filming Top Gun: Maverick years ago, but people are still streaming, renting, and purchasing that movie bringing in massive profit for the studio.