Not just dev projects, everything in life that I decide to do but in the thick of it start hating myself, I repeat those four words. It's usually when running or digging, physical stuff that starts to really suck halfway through.
I also think subjecting oneself to activities which really suck, physically difficult and painful things, and persevering through them, is generally helpful. It tempers oneself by conquering higher forms of suffering, no amount of poorly documented APIs can shine a light to a week of digging with a pickaxe and shovel.
Just getting to being able to run 4+ miles teaches some useful lessons IMO. There's an entire headspace to be explored in doing endurance activities that probably confers benefits everywhere in life, not even considering the exercise aspect.