That's something I wrote based on the book "al-Nasb wal-Nawasib" when answering someone who quotes "No one loves me except a believer and no one hates me except a hypocrite."
Love is different levels and types, the most important love in Islam is loving Allah and his Prophet (saw), he (saw) says: "Three shall find the sweetness of faith: They love Allah and his messenger (saw) more than anything, they do not love anyone except in Allah, they dislike to return to disbelief as much as being thrown in the fire."
What you have quoted is very general among the Sahabah to the extent where the Prophet (saw) said: "The sign of belief is loving the Ansar and the signs of hypocrisy is hating the Ansar." This alone covers about 100,000 people. I add, what was quoted for `Ali applies to all believers since loving them for the sake of Allah is necessary due to their struggle in His path and His love for them and their love for Him.
Evidence is that even the narration above is not exclusive for the Ansar since we know that the Mouhajiroun for instance are greater than them, so they are more worthy of being loved and their haters are worse in status. As for `Ali and the prophet's (saw) family, their love is required because of their nearness and blood-relations in addition to piety, the Prophet (saw) says: "Love my household for the sake of my love."
If that's the case then why specify `Ali and the Ansar? The reason is that the Messenger (saw) knew that shortly after his death there will be groups that regard `Ali as a disbeliever and will fight him and because He (saw) knew how the leaders from Quraysh will be in charge and thus the Ansar will be marginalized in all aspects in favor of their Qurashi counter-parts and there shall be injustice.
None however can take those narrations literally and apply them in the sense you spoke of, for simply loving `Ali or any man from the Ansar does not render a person automatically a believer nor will hating them automatically render one a hypocrite or disbeliever, the reason for this is that it depends on the reason for these feelings to manifest. In other words, if I loved a man from the Ansar simply because he had a good sense of humor, that doesn't render me a believer just based on this love. Similarly, if I loved `Ali because he was a brave warrior and a skilled fighter that too doesn't make me a believer. In other words, loving and hating needs to be in Allah, meaning my love for him will be because he was pious and God-fearing and because he sacrificed all for Allah's cause and so God loves him, that's the love intended in this report.
So having love for `Ali is not a condition of being a believer in the absolute general sense, an example of this are those who loved him yet claimed him to be a god, or those who loved him but fabricated stories and lies and attributed it to him such as the Rafidah. In fact, those folks love a fictional `Ali that they imagined in their heads, not the real man similarly to the Christians and `Isa (as). One can even say they are haters to an extent since they loathe those who actually follow `Ali's guidance.
`Ali himself says: "Two will perish because of me, one who loves me extremely and one who hates me extremely." Meaning, not just any hatred and not just any love.
Now we move to the part about hypocrisy and we need to define what type of hypocrisy is intended in this report, since it is of two types usually in prophetic-traditions. In brief, if the hatred towards him was due to his piety and strong faith and love for the religion, like the pagans of Quraysh or the hypocrites hiding among the Muslims, then the hater is a hypocrite in his beliefs and thus outside the folds of Islam. However, if the hater has hated him due to some circumstance, the same way women hated `Umar bin al-Khattab for his harshness, or due to confusion such as the Khawarij who believed they were on the right path and that `Ali was a sinner due to accepting the arbitration, or those who hated him due to an emotional reaction that's embedded in human psychology such as abi Lubayd al-Basri who hated `Ali because he killed some of his relatives in the civil-war, that's identical to the Prophet's (saw) hatred for Wahshi who killed Hamzah even after he embraced Islam and repented.
One cannot describe this as hypocrisy in beliefs, we remember the narration of Buraydah who hated `Ali in the events of Yemen, then came to the Prophet (saw) and professed his hatred, in turn the Prophet (saw) ordered him to love `Ali and so Buraydah says "After hearing this, `Ali became from the most beloved people to me." Again we cannot say Buraydah was a hypocrite who just turned into a believer suddenly, as the hypocrites didn't even believe in Muhammad (saw) let alone follow his orders. Buraydah did not dislike `Ali due to his religion but due to jealousy, `Ali received a bigger share of war-booty and had a high status as military chief.
An example is the saying of the Prophet (saw): "Four things if gathered and combined in the heart of a single man make him a pure hypocrite, but if one of them is found with a man then he possesses a section from the sections of hypocrisy until he leaves it: When he is entrusted he betrays; when he speaks, he lies; when he promises, he backstabs; and when he enters a conflict, he behaves in a very imprudent, insulting manner."
The minor hypocrisy can be found in the heart of any man, it does not cancel faith like the major hypocrisy but it is considered a defect in one's beliefs. just minor and major polytheism, most of us commit acts of minor polytheism every now and then but one cancels faith whereas one is simply a sin which is counted as a defect in one's faith. As for the Syrians they were lovers of `Uthman and their hatred for `Ali was caused by the letters forged in his name by some of the rebels accusing him of orchestrating `Uthman's murder and they saw `Ali in the wrong and themselves in the right all the while accepting `Ali's virtues which Mu`awiyah himself praises at times.
The final nail in the coffin here is that `Ali does not believe what you believe, it was authentically attributed to him in several narrations, such as:
عَنْ أَبِي الْبَخْتَرِيِّ قَالَ : سُئِلَ عَلِيٌّ عَنْ أَهْلِ الْجَمَلِ قَالَ : قِيلَ : أَمُشْرِكُونَ هُمْ ؟ قَالَ : مِنْ الشِّرْكِ فَرُّوا ، قِيلَ : أَمُنَافِقُونَ هُمْ ؟ قَالَ : إنَّ الْمُنَافِقِينَ لَا يَذْكُرُونَ اللَّهَ إلَّا قَلِيلًا ؛ قِيلَ : فَمَا هُمْ ؟ قَالَ : إخْوَانُنَا بَغَوْا عَلَيْنَا
From abi al-Bakhtari and others, he said: `Ali was asked about the people of al-Jamal: "Are they Mushrikeen?" He answered: "They ran fro Shirk." They asked: "Are they hypocrites?" He answered: "Hypocrites do not mention Allah but a little." They asked: "Then what are they?" He said: "Our brothers who transgressed against us."
عن جعفر ، عن أبيه ان عليا لم يكن ينسب أحدا من أهل حربه إلى الشرك ولا إلى النفاق ، ولكنه كان يقول : هم إخواننا بغوا علينا
From Ja`far (al-Sadiq), from his father: That `Ali did not attribute neither polytheism nor hypocrisy to anyone from those who fought him, rather he would say: Our brothers who transgressed against us.
Notice, this isn't just about holding grudges, this far exceeds it as it's his opinion about those who actually fought against him, so `Ali never understood from it what you said nor was it intended in the context that you speak of and he treated his opponents accordingly as is transmitted by Tawatur.