Am I reading this right? You worked double time for months, and in that time you neglected your own job, without it being authorised by your line manager?
All so that a manager in a different department wouldn't look bad for losing an entire team in one go?
That's the lesson. Don't do that. Pick up extra work if you want to, but always do your own job first.