I disagree. I think it depends on what the "this" or "that" refers to and the attitude of the speaker to the thing.
Suppose I am doing a crossword puzzle with my girlfriend and it gets late and we aren't done yet. She tells me she is tired and wants to go to bed and wants me to come to bed too. I say: "I want to stay up a little later to finish this puzzle." She says: "Well, allright. But don't come to bed too late. When you're done with this, come to bed."
She uses "this" because she was doing the puzzle too. If she had used "that", in would put some distance between her and the puzzle.
Also, we're in the middle of doing the puzzle, so the puzzle is present to us as she is making the utterance.
I can also imagine a child is watching a TV show and wants to stay up later to finish watching it. The parent says: "OK, you can stay up later, but when this is over, go straight to bed." My intuition is that "this" is used here because the TV show is ongoing at the time of the utterance and in the presence of both mother and child.
"That" would be used when the action has not yet begun. In the example you gave Und wenn du das gemacht hast, geh bitte ins Bett I imagined that the mother says to the kid: "Go brush your teeth.. and when you have done that, go to bed." She uses "that" because the event has not started yet and perhaps she expects not to be present during it. She is going to bed herself and won't be present. So she can't refer to the event of toothbrushing as if it were something in front of, near, present to her, etc.