For iRacing with the Stay Connected To This Game Until I Manually Disconnect option checked, the After Game Launch Tasks (and any 'Kill after game exits'-enabled Before Game Run External Program) runs when the simulator (iRacingSimDX11.exe) exits a session, then immediately runs the Before Game tasks again while waiting for the simulator to launch. I think it would be preferred if the Launch Tasks triggered on opening and closing of the SimCommander profile instead of on each invocation/termination of the simulator executable.
I don't think this would change the behavior for other profiles since those effectively always close the profile on game executable closure.