Writing new stuff from scratch is fun, I have zero problem being motivated to code things that are hard or challenging. And I can keep focusing for a long time.
However, if my task is to shoehorn some code that I know to be crap into my project for x or y reason, oh boy, then I can drag my feet for a looooooooong time.