Why do you think Musk put so much money into helping Trump win? Tesla was under multiple investigations for safety and unkept promises, and he knew that he would not have leverage to halt those under a Harris administration.
He was under some imaginary assumption that Trump cared about the national deficit because of his campaign speeches. Once he realized that Trump really didn't care two hoots about it and only planned to increase it even more he had a late buyer's realization.
If he thought trump would actually adhere to anything he said... or, for that matter, was the least bit consistent in what he did on a day-to-day basis, then Elon is not fit to pull his own pants up in the morning.