There is a tendency to define ourselves by our work. At a high level, there is some validity to that – anything we do for 30, 40 or more hours a week certainly is a part of who we are. But we often take it too far. We become personally attached to our employer, our project, or the technology stack we prefer.
The reason that is taking it too far is because it absolutely will change. Your employer is rarely truly loyal to you at a personal level. Your technology stack will change over time. And your projects will change.
In particular in the software world, few companies just build a product and then maintain it forever. (And few coders would even enjoy that.) Your product is quite likely to either grow, shrink, or be purchased by someone else. Your leadership will change. These things are mostly out of your control.
That brings a personal danger to your own mental health to invest deeply in a specific piece of your job, because it will change. And you would then need to go through a process of re-defining your self. Instead, define yourself by the areas you control – you control whether or not you choose to stay in your job as changes come along. You control setting boundaries with your employer to maintain a healthy work/life balance. You control how much energy you put into improving your role within a company vs. improving your skills and capabilities in general.
Keep your self-identity focused on your own path, not on the specific job you happen to be in today.