The Metropolitan Opera and the New York City Ballet have hired outside law firms to conduct internal investigations after sexual-harassment allegations were lodged against powerful figures at their organizations.