Those solutions are really bad workarounds.
It's unrealistic during scripts or C# automation to keep asking to kill and redo powershell processes.
Simply improve your PowerShell or module to not download so much data in Temp and better clear cache everytime we do a Connect / Disconnect. Not only it fill PowerShell cache, but also fills the Temp folder.
EDIT: How come not all commands are simply already there with the installed ExchangeOnline module?
When doing Remote Onpremises Exchange, with the Exchange Management Tools installed, you can query Exchange without having to download anything as every functions and Cmdlets are already locally there.
Especially now you say you use REST, those are supposed to be simple WebHttp requests behind commands.