AC compressor

2010 Glk 350.  A/C blowing hot air intermittent ly. Sometimes A/C works and other times it’s just hot air.  Diagnostic came back that electrical part on compressor was overheating and so I need to replace compressor. Also told to replace expansion valve, dryer, flush and recharge. Do you agree?