A discrimination and retaliation lawsuit has embroiled the upper reaches of the federal government’s immigration enforcement agency, contributing to a sense of turmoil in a bureaucracy that has been suffering major labor conflicts between senior officials and employees.