I think that @martin3141’s definition is pretty good for counting, but we still need to consider some possible issues with defining life and death.
Clearly, we need to either first agree on which stones are dead and remove them, or play out an “encore” phases to the capture dead stones that we wish to see removed, since we’d want to avoid counting lone dead stones as a group.
However, it is possible to have positions where one wants their opponent’s stone(s) to be alive, while the opponent wants them to be considered dead!
Imagine the following position (if we do not allow suicidal moves)
Black would want their own stone at tengen to be declared dead, while White would wish to contend that it is alive! If we call it dead and remove it before counting, White would only have one group while Black has three. However, if we call it alive, then White would have three groups and Black has four. If komi is “1.5 groups”, then this dispute would decide the game.
It seems that one possible resolution would be to allow suicidal moves, such that Black could continue play to settle the dispute by removing their own stone.
Overall, this variant seems to have weird pathologies in that players would try to create territory as inefficiently as possible and sometimes wish to suicide their own stones to cause their opponent to connect.