Being a mid-career generalist is like not having chosen what degree you're going to graduate college with in your second senior year. You haven't done anything long enough to become an expert at it, to have it be second nature, to be able to teach others, to be able to lead a team at it, to be able to architect it. You're just a very experienced dilettante.
Early in your career when you haven't decided what to specialize in, that's cool. Late in your career, when you've specialized for several years in several different things such that you can wear any hat as a senior person, that's also cool.
Mid-career? Not so cool in the eyes of companies, where they want specific roles filled, not "find a problem and fix it, rinse, repeat."
If you're going to truly escape, then you're essentially restarting your career as a generalist at rung 0, ground floor, grunt work development, and hoping your experience gets recognized and you are allowed to rapidly advance within an organization.
Either way, it's not an easy path at this point. (I chose to restart my career about seven years ago, and am just about now "where I was" but in a different field.)