You're not having a midlife crisis, you're just asking the right question too late. The thing is, stability isn't poison - it's just neutral. A permanent contract for 10 years with decent pay is the foundation for actually living, not an obstacle. But if you're doing it on complete autopilot without ever asking yourself what you're doing with your free time, yeah, that becomes empty.
The real problem isn't the job itself, it's that you need to stop waiting for something to change for you. Your colleagues making different choices, maybe they're freelancing, doing their own projects, weird stuff - but they're doing it on the side, not instead of a steady paycheck. You've got the luck of having time, money, and security to really explore, and you're just using it to go home. Do something. Anything. A hobby you're obsessed with, volunteering, some stupid project. It completely changes your relationship with work when you know your real life is happening elsewhere.
After ten years, you deserve to ask yourself "do I want to stay here", but it's a real question, not an existential one. If the answer is no, you leave. If it's yes or "not sure", you stay but you stop waiting for work to fulfill you. A lot of people burn out because they're asking the job to do the job AND be their life - that's impossible.