Recruitment to Resignation: My Four Months at Microsoft
medium.com
medium.com
If you are on the verge of resigning then you no longer have anything to lose and so you should have gone to your bosses boss. Point out what happened and why you are leaving. Doubt it would have solved the issue but it does mean that his behaviour was flagged up to another level. Otherwise there is no downside to his treating people the way he did.