The abrupt departure of Apple’s top automotive executive imperils its efforts to develop a self-driving car, a project that’s been seen as one of the tech giant’s biggest bets.