That sounds exactly like what the ADHD community calls a "hyperfixation". If you do want to look down the ADHD path more, here's some articles and such that might be helpful. Obviously, see a therapist about all of this and get diagnosed too if this all seriously resonates with you.
- "Why I Procrastinate" - https://invisibleup.com/articles/27/ (disclaimer: i wrote this one)
- "ADHD: A Lifelong Struggle" - https://gekk.info/articles/adhd.html
- ADHD Alien comics - https://adhd-alien.tumblr.com/
- Dani Donovan's ADHD infographics - https://twitter.com/i/events/808796572716765185