No,what what you said isn't true, this narration is not related to the establishment of a government, but rather is meant a call or uprising.
Invite has two types:
callCall to the void and non-religious purposes which is related to self (nafs) and is doomed.
callCall to remove void and for right purposes which is approved by Imams.
In this narrative,that that flags have been raised to invite to self (nafs) purposes, not flags which have been raised for the invitation to the right.
In other words,flag which is Opposite of Ghaem is idolatrous,not flag which supports Ghaem.
This narrative from Imam Baqir (a.s.) confirms it, which says:
Everyone who raises "the flag of mislead" is Taghut (satanic rebellion)." (Alkafi, vol. 8, p. 297)
It is likely that this narrative was about a particular case in the past and is specific to that situation. It means that certain issues about invitations and flags was raised at that time which caused public debate and the Imam said that in response to the controversies surrounding them.
If we apply the narration to all times circumstances, it will conflict with many other hadiths that describe other uprisings that are just and rightful:
"There is no flag more guiding than the flag of Yamani, it is the flag of guidance, because he calls to your Sahib (owner, i.e. the Imam), so if the Yamani comes out, selling weapons to people or any Muslim becomes prohibited (Should be given to them free), and once Yamani appears, rise for him, because his flag is the flag of guidance, and it is not right any Muslim to turn away from him, and who ever turns away from him, he will be of the people of hell, because he (Yemeni) calls to the truth and to the right path. (Bihar al-Anwar, vol. 52, p. 230).
Prophet (PBUH) said: "People will rise from the east and prepare the groudnground for government of Mahdi (as). (Bihar al-Anwar, vol. 51, p. 87).
Jabir ibn 'Abdullah said: I heard the Prophet (PBUH) said: "A group of my Ummah will steadfastly crusade for the right and will win until the Day of Resurrection comes". (Sahih Muslim)
Prophet (PBUH) said: "This religion will persist and the groups of Muslims firghtfight for it until the Day of Judgment comes."(Sahih Muslim)
Interpreting the hadith as forbidding all forms of struggle for good also conflicts with narrations stressing jihad and enjoining good and forbidding wrong. Because defense of Islam and Muslims is the most important obligation and duty in kitab and sunnah.
Therefore the denounces those flags that call to egoistic ends, not flags which have been raised for invitation to the right.