While investigating the options for my problem here, I went down the rabbit hole and discovered another but related potential issue.
As far as I see, the Spindel start (M3 S0.000) is always initiated by a toolchange operation(M6). In my opinion this can be really problematic. Something like starting a spindle, laser, waterjet, etc. should always be done explicitly before an operation and not by a toolchange. Also keep in mind, that some machines ignore the spindle speed (S0.000) and switch on the spindle, as soon as they see the M3 command. So M3 S0.000 is really not the same as not starting the spindle at all. Not fun if the tool that happens to be in on the spindle is a drag knife for instance.
I would suggest, that the tool controller determines whether the spindle start command is issued or not. Maybe it can be a checkbox besides the spindle speed field. (Maybe If we could get hold hold of the M3/M4 command in the postprocessor (as operation), the postprocessor could eliminate the M3/M4 command if S is 0 so we would not need a checkbox in the tool controller. There we could also include the G4 command.)
Also I don't see, why a toolchange is an operation and starting the spindle is not. If it would be an operation, we could probably put some spindle specific code pre or post it in the postprocessor, just like it is done (pre) with the toolchange.
In any case, starting the spindle should happen right before the operation that needs it and not after the operation of changing a tool.
What do you guys think?
P.S. I tried to catch the M3 / M4 commands in the postprocessor, just like it is done with M6, but had no luck. I think this is because M3/M4 is not an operation, right? Also I can not see any output / error messages from the post processor in the python console. How do you handle this?
Thanks again for your help