That said, if you aren't an owner of the company then I think it's unhealthy to be emotionally invested.
In my last job, I had received a competing offer and informed my boss that I would rather not leave but that this other offer was too financially good for me to ignore. My boss responded by beating the other offer and I stayed there for about five more years.
I later admitted to him that I felt guilt about leveraging an offer in this way. He said something that really stuck with me: "You've got to put yourself first".
In retrospect, the thing that actually stuck with me is that I'd gleamed into the mind of upper management. That is, they are putting themselves first, and so should you.
I know I’m speaking about effort, and you’re speaking about becoming emotionally invested, but the latter is a natural manifestation of of the former; the emotional investment arises because of the effort I put forth.
In the tweet, he said that when coding, he'd start by the smallest possible PoC, and code it entirely front to back. That'd give the general structure, and then he'd build upon that. (this is what I remember of it fwiw).
I do this all the time too, which I think is a vastly superior approach to TDD, which assumes how an API is going to be used, without actually writing the actual thing that's going to use it.
Most of the time, any major features that require refactoring are usually around the data model and its representation in code (the existing control flow and overall flow of a request through the system is generally fine).
I will build out what I believe the new data model should be, and then just work front-to-back, updating any references and refactoring the shared state and responsibility into the new data model, clearly separating out concerns and encapsulating responsibility.
This method has proved itself time and again, and I recommend it to anyone who needs to make large changes to and existing code base. That is, start with how the kernels of data, state, and responsibility should look, and everything grows from there.