Management people like that do deserve your ire. They’re shit people who make it hard for everyone else because they have an extreme authoritarian view of running the corpo and will do what they want at the expense of rationality.
It’s extra stupid because if someone they need (very specific need for a pet project basically) or someone they know personally comes along - that person would get all accommodations in a heart beat.
But your team means nothing, the project means nothing (unless it is the pet project of the dipshit who gets to make the decision). They’re a shit person and you can’t change that and it sucks.
Sorry the inflexibility of dipshit management is hurting you. It happens and it’s their fault, they will cause damage to the corpo, but they’re also probably too weak to tank the whole thing. Just a callous inefficiency. And you can hate them, they deserve it. It’s so easy to see a way towards a solution - but if bozo thinks bozo can get away with burning you to preserve some ephemeral corporate mandate for “in person”, bozo will burn you. The corpo mandate may disappear in a few years, but all that dipshit can do is think short term. And it sucks for you, it suck’s for your coworkers, and again, I’m sorry.
Be stronk, your labor is your power. You’ll have to leave with your power, and that sucks ass. But your partner will be happy, and that may be worth it to you - especially if this corpo has bozos like that in high places, you’d probably run into something stupid that would be a deal breaker at some point.
Lastly, no allegiance to the corpo, but your coworkers can be good. They may advocate for you, they may reference for you. Don’t trust anyone or any promises from corpo, including your local manager on up. Ideally that’s not how it should work - talent is talent even if you have to be flexible to keep talent - but corpos are authoritarian by nature and lack guardrails so dipshits get hooked on capricious short-term behaviour.
Be pissed, fuck em, don’t train your replacement & walk out before that, remember you’re worth keeping in a sane world, because you worth it
Edit: lastly, don’t dwell on it. Leave the shitstain where it is at your old job, don’t bring it in your mind. That’s really hard because it’s literally one capricious decision causing the issue - but do it for your sake. That’s the cost of living in authoritarian structures, don’t let it eat at you. You worth it, you’ll find something else