One weird trick: leave some code NOT compiling or with failing test or runtime error. Come in, reproduce the error and you’ll be back in it quickly!
I will say, this did not occur when I "picked up" something else. If I worked on another project or went to the gym and did something stimulating (sparring, not just picking up weights), then I had no issues disengaging from the day's work.