I've changed the timer.py code as per your changes and run it on my box
3 times in a row the box went into standby at the expected time - all OK
I set a recording for 20 minutes and set a non-recurring go to standby power timer to trigger half way through this recording. At the half way point (plus the countdown time) the box entered standby. The box can record in standby and continued with the recording - all OK.
I repeated the recording test with a non-recurring go to deep standby power timer set to trigger half way through the recording. At the trigger time the power timer changed its reporting from 'waiting' to 'about to start' and
reported a new (start) time that coincided with the end of the recording. As the recording finished the power timer cut in and the box went to deep standby - all OK
It looks as if the bug is fixed