I don't do plasma but tool width compensation is common.
You have a pretty good idea of what happens already. It is pretty logical in nature. The compensation is set in the machine as a tool definition. In your example, T21.
The actual work is done by the software where is looks at the tool path supplied (the g01 codes), looks at the next code to know which is left and right as it depends on the direction it is moving, and then does the compensation based on those values.
The tool definition is used until it is changed, the compensation is canceled, or program is ended. These are things that are software/machine dependent and most can be changed in how it behaves. Without my reference, I think the G40 is where the compensation is turned off in your code. I run a mill so there are some differences but the basic concept is the same.
Hope this helps. If I'm off base, I'm sure someone will correct me. This is how I understand things and it seems to work for what I need.