That's missing the point, though. It's about regret—what people feel they didn't pay attention to when they were younger and healthy, not what is going on at the moment of death.
To say such a thing also isn't necessarily opposed to belief that hard work is good, or that it is valuable to one's self and society. It simply means that if you work too much, you can miss out on life.
Or that death is a very emotional time which increases our desire for people/things that play on that emotion - such as family. But even if this is the case that does not mean that the person did not get more enjoyment from what they actually did than to what was thought on the deathbed.
To say such a thing also isn't necessarily opposed to belief that hard work is good, or that it is valuable to one's self and society. It simply means that if you work too much, you can miss out on life.