As an aside from that though, recent & planned changes in UK regulation are trying to put more onus on social media companies to police their dungeons, and they don't like that. I'm sure this aggravation has a causal relationship with Musk getting very anti-UK-government ATM (spreading “facts” about them that range from somewhat dubious down to outright lies & calls for vigilantism) – trying to push attention away from SM and its role in various problems. Pulling out of the UK will reduce their legal (and financial) risk exposure with regard to these regulation changes.
Moving jobs back to the US (or appearing to), cancelling DEI programmes which are not approved of by the incoming administration, etc all lines up with this.
The more difficult question is whether Meta is the chicken or the egg. OP suggests Meta are courting Trump’s approval. I’m not so sure that Meta didn’t help put him there in the first place.
It’ll absolutely work, too. The new President loves to hear how good his ideas are.
He’s been speaking lately (on JRE just a few days back too if I’m not mistaken) about the responsibility of the US government to protect US companies abroad rather than hurting them at home. This was targeted specifically at Trump, and trying to encourage him to get on Meta’s side with regulators.
He also said on JRE that the Biden administration would yell down the phone at his staff for not censoring facts, this is to rile up the GOP in Congress to pressure Trump to be seen doing the opposite and standing up for free speech (as Meta defines it).