Reading through what you said, it reminded me about how the Learning how to Learn Course [1] tackles procrastination. Basically the way I understood it (hopefully I did it right), if you focus on the product (ie. the final goal), our brain activates the pain sensors which make us look for other activities that will be more fun to do. The suggestion is to focus on the process (or system) that will eventually get you to the goal, using small periods of focused attention that can be individually rewarded (like spending some time doing relaxing and/or fun activities after focusing on the task).
[1] https://www.coursera.org/learn/learning-how-to-learn