The ride-hailing giant learned to thrive in legal gray areas while Beijing mostly looked the other way. Now the government is paying attention.