They do, and plenty of Westerners (Indian origin and non-Indian origin) return to India to work for Indian companies, found their own companies, or manage American operations.
Though, IME, it tends to be Japanese, Israeli, Singaporean, and Korean expats who can hack it in India. Western European and Americans are too soft.
I have not seen it happen in a permanent way.
I doubt a visa for generic remote based web dev work would get approved. In fact, I believe the visa even states you have to have a skill that is not readily available in India.
The reality is your generic dev would probably not qualify especially if they are outside of a company.
They don’t want other countries citizens competing for jobs in their own country, which is effectively what is happening in the us now.