This certainly rings a bell with me.
Many of my relapses happened at the moment I was about to successfully complete a project; often - as you say - when completion is only a formality.
I'm beginning to realise just how cunning my alcoholism is and that if I'm 'resting' (or taking my sobriety for granted in any way) then it is 'doing push-ups in the back yard'.
For me, it is related to feelings of self-loathing and a deep-rooted belief that I just don't deserve any of the good stuff.
If I'm diligent, and take care of the small flowers in my garden on a daily basis, then this particular behaviour stays quietly in its box.
Hope this helps.