I have been digging a bit in the code of the RTT, as I consider a small modification of the basic state transition diagram. I have found that I actually can accomplish my goals by writing user code in the updateHook() function of a subclassed TaskContext. So I can solve my problem; but I think it could be done in a nicer way.
I think it would be more elegant if ExecutionEngine would have a "UserCodeProcessor" that implements the behaviour that is currently present for user code processing, instead of hard-coding this behaviour in ExecutionEngine itself. Then, I could simply write my own UserCodeProcessor, in the same way as I can now define my own CommandProcessor.
What's your opinion on this?