Yes, it is true that Vali himself ordered Sugriva to stay vigilant at the entrance of the hole, through which Maayaavi entered.
इह तिष्ठ अद्य सुग्रीव बिल द्वारि समाहितः |
यावत् अत्र प्रविश्य अहम् निहन्मि समरे रिपुम् || ४-९-१३
Then Vali said to me, "Now you stay here on the alert, Sugreeva, at the entrance of this hole till I return on destroying the enemy in a fight on my entering this hole..."
After waiting for 1 year, and hearing roars of Maayavi but not that of Vali, Sugriva concluded that Vali was dead. After covering the cavity with a big boulder, he returned to Kishkinda. And, he was made the king by the ministers.
On his return, Vali banishes Sugriva, regains his kingdom. So far so good. However, the crux of the issue is Vali captures Ruma, the wife of Sugriva and enjoys her by force.
तेन अहम् अपविद्धः च हृत दारः च राघव |
तत् भयात् च महीम् सर्वान् क्रान्तवान् स वन अर्णवाम् || ४-१०-२७
"Thus he threw me away and even stole my wife, oh, Rama, and owing to his fear alone I roamed all over the earth with its forests and oceans."
Vali might be eyeing Ruma for long, but could not get opportunity to enjoy her sexually, as he was the king and Sugriva was his brother.
On the pretext of Sugriva's crime, he capatured Ruma and enjoyed her sexually.
One of the reasons for Sri Rama's elimination of Vali is Capturing of Ruma, who is equal to his daughter-in-law. It is against the Dharma.