I think the main reason was the bad relationship between Laporta and Xavi otherwise he could stay for the next season.
Even Flick was not successful recently and they could have much better coaches instead of him
Xavi was expected to be kicked from Barcelona at any moment especially that few weeks ago he was declared out then resumed... Their might be some misunderstanding and tensions between him and the staff but that was mainly due to the poor results they had and for not winning anything this season.
The way Barcelona president dealt with the Xavi Hernandez issues has got to be very poor truthfully, how do you treat a club legend this way? Meanwhile he didn't even get the necessary backing needed for a successful season.
They gave him treatments they should have given Koeman the one time club player and also coach. Xavi Hernandez did better than him and should have had a better treatments.
It is what it is right now I must say.
I love Hansi Flick, I know he will do a good job in replacement of Xavi Hernandez and should already be aware that the management and club has no much money to fund whoever he wants, he will have to work with the young players from La Ma Sia who are heavily talented.