Elon Musk's imminent departure from DOGE followed several weeks of tensions between him and other Trump cabinet members.