One thing to always bear in mind for this sort of question is: if this wasn’t a viable strategy for the octopus, we wouldn’t have any of that species. Evolution doesn’t always find the optimal solution to any problem - just solutions that happen to work well enough.
But in cases where the offspring (be they eggs, seeds, larvae, etc) are not nurtured by the parents, any energy and resources reserved for the survival of the parents is energy/resource not available to the next generation - in practice (and all other variables being equal) this means that if the parent must survive, there will probably be fewer offspring, or they will be weaker.
Once a species has developed that reproductive strategy, all of its descendants will have a tendency to follow suit - and the strategy can become so embedded that even when some other way would be theoretically better, there’s no way to get to there from here.
Imagine you’re a mountaineer; climbing toward the peak of the nearest mountain probably won’t get you to the peak of the tallest mountain in the world, unless you descend and try another one - and in many cases, descending would mean starting over from scratch - this is the founder effect - you can only reach the summit of the mountain you’re actually climbing.