Thank you for your question. This sentence is not found in the primary texts of Shia or Sunni ahadith. There is a similar phrase found in the Commentary of Ibn Abi al-Hadid on the Nahj al-Balagha where he mentions some phrases attributed to Imam Ali, but it is only an attributed phrase rather than a reported hadith. There are other versions of this phrase that are also not ahadith such as:
التكبر على المتكبر صدقة
التكبر على المتكبر حسنة
But while the phrase may not be a hadith the concept is not entirely misplaced and it is an issue of enjoying good and forbidding evil which ultimately goes back to wisdom. If you are able to stand in the face of a haughty person, possibly in a dangerous situation, for the betterment of that person or for the religion that that is a praiseworthy act. Like the stance of Imam al-Sajjad (as) and Sayyida Zaynab (sa) in the court of Yazid. The roots for this stance may be found in verse 54 of sura al-Maida where the believers are described as “humble towards the believers, powerful against the disbelievers...”.
The important point here is to distinguish between this type of strength and arrogance, as arrogance in the face of arrogance has no value and is a blameworthy trait of the soul. Rather, this type of strength stems from humbleness in front of God.
May you always be successful.