Essentially their entire mating cycle is what causes this. They've got a gland behind the eye that puts them into mating mode and once it starts it never turns off until they overdose on sex hormone.
Most cephalopods are voracious hunters that eat and eat to grow big and then once mating mode switches on they just focus on mating, which results in a shit ton of babies. Every step of that cycle has an extremely high mortality rate resulting in strong selection pressures for the best of every phase. When they do something, they go big.
There's a specific life history strategy called semelparity, which is what you're describing (breeding once then dying). To my understanding, this is incentivized if the chances of getting a second attempt to breed are too low, and so it becomes more evolutionarily advantageous to simply go all out on the first attempt
A bit similar process in sea-dwelling salmons: migrating from salt water into fresh water (quite a big metabolic challenge in itself), traveling up rapids to suitable spawning places (often a long and arduous journey)... after they've accomplished that, their chances of returning alive are quite low. So they mostly die. But their close relatives, river-dwelling trouts spawn many times in life, because their migration isn't as costly.
I would suspect that something in how octopuses reproduce has an element of "return being costly" - it could be a metabolic return to the feeding and growing state instead of a physical return.
That makes sense, if there is an organism that is a very good predator, and the chances to breed a second time are too low, then if the organism doesn't die it will be consuming the resources of those who can breed. Natural selection must prioritize having descendents over long living, because not having descendents is extinction.
Not everything in evolution ends up having a point. So long as a problem does not impact the propagation of children it can end up moving forward to the next generation.
I would guess that if there is an Evolutionary reason, it's probably that octopi with this drive reproduced More than octopi that didn't.
Take that point and explain humans living to about 100 after breeding from 20 to 40, and kids taking ~15 years to become good enough
Human tribes doing well is good for making children successful, old women have much better skills in finding whatever plant matter they're gathering, old men are better at tracking and stalking prey. The old people teach the young.
We evolved towards longer lifespans because groups that live longer survive and continue better
Good. They deserve it. Octopuses are dicks. They keep demanding you to call "octopi." Sure. When you start calling me and my homies squidi, I'll start calling you guys octopi.
But no, they can't see past their octopus privilege. As if having two fewer arms made them superior.