After five years as a U.S. magistrate judge for California’s Northern District, Paul Grewal had his future mapped out. He’d spend the next three decades on the bench and retire. Up to that point, he’d followed a relatively traditional path from law school to a clerkship to a Big Law partnership to a judgeship.

Grewal would have stayed the course, if not for an opportunity to join Facebook Inc.’s legal department in 2016 as deputy general counsel. Grewal couldn’t resist the challenge of going to work for a rapidly growing company that was, in his words, “confronting serious issues over and over again.”