The virtues of Ali ibn Abi Talib a.s were well known. In the famous hadith in saheeh muslim, we find Ali ibn Abi Talib a.s reporting:
"The Prophet [SAW] made a covenant with me that none would love me but a believer, and none would hate me but a hypocrite." [Saheeh, contained in Muslim among others]
If one were to go through the sihah al sitta, and musnad ahmed, the praises for Ali ibn Abi Talib a.s are so numerous, that there is no excuse for any of the companions not to have known the virtues of Ali ibn Abi Talib a.s.
The issue with yemen, the booty, the khums, the slave girl, if my brothers in the ahlus-sunnah were to be consistent, ought not to have been about the sahabah hating Ali ibn Abi Talib a.s, rather, it is to do with a fraction of the 300 having disagreements with Ali a.s as to his judgement on the booty.
Therefore, Muhammed s.a.w would have achieved absolutely nothing by telling people, if i am your friend, than Ali is my friend, They knew that. Infact, Muhammed s.a.w during his life had given Ali a.s far, far stronger praise than merely this.
Rather, what a fraction /group had with regards to their issue with Ali a.s is how he handled the khums. They wanted to know if the way he had handled it was truly in the way of Allah azwj, or if he was just favouring himself first? (due to alleged intercourse with a slave girl).
That's what they wanted to know. They knew of his virtues, and praising him many times would make no difference, if Rasullah s.a.w did not directly address this issue.
By calling him a friend to the believers, it does not address that issue.
However, we do find in Ibn ishaq, and Ibn Hishams works (some of the earliest biographies on Muhammed s.a.w,) we find that not only does Muhammed s.a.w admonish individual companions like Abu Huraida specifically on the issue of Khums, he directly addresses the issue, infront of a crowd, whereby he reminds them that what Ali a.s did was equitable, fair, and that he is far too scrupulous in the way of Allah azwj to be favouring himself. There and then, the matter ought to have been totally finished. Many had heard it, and those that did, conveyed it to others. During the Hajj, amny were gathered, and so, the very powerful statement Muhammed s.a.w made should have spread.
There then came a time when Muhammed s.a.w, after having received complaints from individuals/groups, and after having responded to them, arose to make a general statement: “..When the people complained about ‘Ali the Messenger of Allah stood up to address them…” [Al-Bidayah wa an-nihayah vol 5, page 95 ; Seerah Al-Nabawiyyah, ibn Hisham, vol 4, page 259] And he said: “Do not blame Ali, for he is too scrupulous in the things of Allah, or in the way of Allah, to be blamed.” (Ibn Ishaq, Seerah Rasool-Allah, p.650)