All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ʻalayhi wa sallam, is His slave and Messenger.
This hadeeth was narrated on the authority of Salamah ibn Al-Akwa’ as he said:
“We went out to Khaybar in the company of the Messenger of Allaah, sallallaahu ʻalayhi wa sallam. While we were proceeding at night, a man from the group said to ʻAamir, ‘O ʻAamir! Will you not let us hear your poetry?’ ʻAamir was a poet, so he got down and started reciting for the people poetry that kept pace with the camels’ footsteps, saying, ‘O Allaah! If it were not for You, we would not have been guided; nor would we have given in charity, nor would we have prayed...’” [Al-Bukhari and Muslim]
The words of ʻAamir ibn Al-Akwa’ were not addressed to the Prophet, sallallaahu ʻalayhi wa sallam. Rather, they were meant as a supplication to Allaah, as evidenced by the use of the Arabic word “Allaahumma (O Allaah)". The word is missing in the version cited in your question.
Even if we assumed that ʻAamir ibn Al-Akwa’ was actually addressing the Prophet, sallallaahu ʻalayhi wa sallam, with these lines of poetry, this would still not serve as supportive evidence for their claim. Al-Haafith Ibn Hajar wrote:
“It was said that these lines of poetry were addressed to the Prophet, sallallaahu ʻalayhi wa sallam, and they meant, ‘O Prophet of Allaah, excuse our neglect and failure to support you as due and fulfill your rights over us.’ Based on this view, the word ‘Allaahumma’ was used as an opening expression and was not intended as a word of supplication in this context. The rest of the statement was addressed to the Prophet, sallallaahu ʻalayhi wa sallam; it meant, ‘If it were not for you (O Prophet of Allaah), we would not have been guided...’ Then ʻAamir supplicated to Allaah, ‘O Allaah, confer serenity and calmness upon us to make our feet firm when we meet our enemy.’ It could also mean, ‘O Prophet of Allaah, ask your Lord to confer serenity upon us to make our feet firm when we meet our enemy.’” [Fat-h Al-Baari]
Based on this scholarly opinion, ʻAamir's poetry is considered a permissible form of tawassul (seeking intercession) with the supplication of the Prophet, sallallaahu ʻalayhi wa sallam, and there is no religious impediment to that (as the Prophet, sallallaahu ʻalayhi wa sallam, was actually with them at that time).
In fact, these people (Barelvis) exaggerate by bringing forth any evidence to support the practices of disbelief that they carry out, such as impermissible forms of tawassul and pleas to other than Allaah and seeking relief or calling on someone for help during distress, which have no basis in the sharee'ah. However, these pieces of evidence do not support their claims and practices in the slightest. The problem is that such people hold false beliefs and then start seeking supportive evidence for them. The Muslim should found his beliefs and actions on the established pieces of evidence and not the other way around. Please, refer to fatwa 87790. Also, refer to fatwa 16690 about the kinds of tawassul.
Allaah knows best.