Had Alipio Ribeiro pointed to him the diplomatic gaffe, they could have rectified it, it wasn't as enormous as that.
Therefore I think that the occasion was there and was seized to have him away. It was very clear from the very beginning that the McCanns would never be sued in Portugal, since nobody thought they had murdered their daughter. There was nothing to gain but problems. Amaral risked to go too far, obsessed by finding what happened to a little girl for whom he cared, without having a global view of the situation. I think MeM had GA in mind in the AG report when he mentioned The Pledge. Requiem for the police novel of Friedrich Dürrenmatt.
My impression is different. The diplomatic gaffe criticising an overseas police force that had provided as much support as possible may well have been the last straw. A broader issue, building up to that, is that Ribeiro would no doubt have been aware (or could have worked out) that the team was leaking half-truths like a sieve, all intended to sway public opinion against a family, while in reality the team was wildly out of its depth. For a country in which judicial secrecy is supposed to be respected, and in which the media spotlight was on the competence of the investigating team, a public professional fault could have been an opportunity to halt what may have been felt as an escalating national embarrassment.
Like any human being, I've no doubt that he would have been proud to have found Madeleine, however I feel less convinced than you that he was obsessed by finding out what really happened to her as opposed to pursuing a hypothesis requiring such leaps of logic that, in view of the plethora of alternative "parentswhatdunnit" theories, even his fans don't seem convinced of how it could have been feasible in practice. Trying to shoehorn a seriously flawed understanding of numerous aspects (to put it generously) to fit his hypothesis doesn't come across to me as someone who is truly concerned with discovering the truth.