Musk's exit comes after he criticised the legislative centrepiece of the president's agenda.