He wanted to leave and had an agreement in place to do so.
It's a case of doing the right thing and doing things right.
Doing the right thing would be acknowledging that the current pandemic threw that out and the actual end of the season happened much later. Doing the right thing would be acknowledging the huge contribution and almost 20 years of service Messi has devoted to Barcelona. Doing the right thing would be acknowledging that Bart even said "at the end of the season Messi can leave if he choses" in an interview. Doing the right thing would be to let Messi leave smoothly if he wants to with a huge thank you and good luck.
However, Bartomeu is in the 'doing things right' camp by insisting Messi stay because it stated a date in his contract because that 'should' have been the end of the season. If Messi had said before June 10th, whilst Barcelona were still in the Champions League, "Right Bart me ol' chum'. I'm out of here!" would Bartomeu have said "Fair enough Leo. It says right there that you can do that so cheers for everything."? Of course he wouldn't. He would have used the very argument that Messi did that the season hasn't finished yet.
So, Messi has been disrespected, shat on, lied to and threatened with legal action by his boss. He doesn't rate the manager, doesn't rate some of the first team players and generally thinks Barca is an absolute shit show right now and yet Messi wants to stay?
Do me a favour.