Is it possible to automatically or programatically disable a service once it has failed a preset number of times?
There is no direct way of doing that as within the architecture the direct support for disabling a flow service is not present. To do this you might need to play with some internal services within the WmRoot package to achieve this functionality.
I would recommend you performing an explicit exit from flow based on the repeat steps’s counter. It would be a safer approach.