Not everyone in the army and police are rushing to switch sides. For one thing, the Taliban are suffering a casualty rate that's more than ten times higher than the army and police. For senior army and police commanders, the government will arrest and prosecute those caught taking bribes. This is not a major risk, but it is there. Corrupt officials also risk getting killed by the Taliban, if your work is not up to their standards.
The drug money, not religion, is causing most of the violence. The drug lords in the Taliban heartland of southern Afghanistan (especially around Kandahar), remember the way the pre-2001 Taliban would make deals. It was basically this. If you want to produce and move the heroin out of the country, pay the Taliban a cut of your profits, and no peddling the drugs to Afghans, or Moslems. That last bit was largely ignored, as in the late 1990s, Afghan heroin was finding its way to junkies in Pakistan, Afghanistan, and throughout Central Asia. The Taliban have returned with promises to bring back the good-old-days. In the meantime, the Taliban offer to provide the guidance and muscle to keep the government from interfering with drug production or shipment.
Afghan soldiers are being mocked by Taliban fighters, because the Taliban are getting paid three times more than the soldiers. Drug gangs are major sponsors of current Taliban operations. Then there is cash from wealthy Islamic conservatives in the Persian Gulf. This means that Taliban gunmen are getting up to $400 a month. Police and army commanders are also being approached, to see if they are willing to screw up, while pursuing Taliban gunmen, in return for thousands of dollars in cash bribes.