Buddhism directly addresses suffering, considering it intrinsic to being experiencers - but not because it is 'out there' but, in our relationship to things. It is desire, grasping, and either not getting, or getting and still not feeling satisfied, which is suffering.
The film Arrival, puts the case beautifully that it's better to have loved and lost, than not to love. Something truly worth doing gives a reward that is independent of failure, or loss.
We expect the universe to end, leaving no residue or record, so we all face this issue. Forward-directed concerns always hit a wall. But what about the concerns of, now?
You seem to assume some kind of utilitarianism, that can quantify and weigh pains and pleasures, in something like Bentham's hedonic calculus. But a life of pleasure, is not necessarily a happy life. We orient ourselves by, and prioritise, meaning. And there is a curious property of meaning, that it can elude us until some insight, perspective, framing, makes sense of seemingly irreconcilable things, and imbues what previously seemed meaningless with meaning. I'd suggest Godel Incompleteness forces this. The truths that can be said in a system, cannot be limited to an algorithm, that can compute them completely. A meta-system, a step out, is required when we recognise a truth not yet part of our algorithm.
I would not presume to make anyone else's calculation of when life is not worth living, the pain too much. But I'd suggest there is always the possibility as long as things are changing, for a redeeming of events up to the point, of reframing. The impact of psilocybin therapy on end-of-life care gives a fascinating insight, into how that can help not only someone facing a painful death, but also their relatives and friends.
Buddhism takes the middle way, between picturing an unchanging eternal soul, and nothing of us continuing after death. Rebirth isn't seen as a salvation, or somewhere better, but as likely worse - animal or demon or ghost habits dominate most people's lives, & will be what is reborn from their lives. In that perspective, there is no running from suffering, in this life, or the next. Only waking up, and finding that reframing, that change of perspective, can end it.