Barcelona spent too much in the past and that's why they have many financial issues in their teams which is the reason for them to sell some players. But recently they tried to spend less money and don't hire expensive players, that's why they could hire Messi for the next season. But I think they will try even harder to buy Bernardo Silva from Manchester City if they really want to make it happen.
If Barcelona were able to hire Messi, then I assure you, they would definitely do it. There was simply no certainty this time and everything could have gone down at the very last moment, so Messi, already taught by bitter experience, did not wait out of harm's way this time until the very end without any guarantees for a positive outcome of the case and signed a contract with Inter Miami.