Drivers for ride-hailing apps such as Uber and Lyft celebrated Tuesday after Massachusetts became the first state to recognize their union, a milestone in the growing effort to organize gig-economy workers classified as independent contractors under federal labor law.