Perhaps after the Tang take them in, they manage to become court eunuchs or something. Perhaps they could be court advisers for things like trade, and they could dominate the whole ministry in charge of trade. Maybe they then bribe the Emperor and other departments so that they gradually take control?
Is this too implausible?
I faintly remember from my Chinese history lessons that one of the late Tang Emperors ordered the massacre of the buddhist monks. Perhaps this could act as a prelude to the adoption of islam?