When my Father had (and eventually died of) cancer, my Mother adopted a similar attitude to your OP.
After all the angst and sympathy from family and friends, it kinda wore thin. My Mother being of the stoic variety adopted sarcasm and humour to cope. It worked, my Father understood, we understood, everyone around us did too. The attitude didn’t wear well with a few of his old work colleagues though, but they kinda came round.
In the main its a coping mechanism, often the comment was given to garner a response that either made light of the situation, or add humour, or provoke a more inquisitive one.