Suggestion: CubeMX to generate hal-style code but not fiddle with main() etc.
I find it very impractical that CubeMX keeps regenerating entire project to update clock tree and/or adjust settings for some hw units and in so doing deletes the original folder by renaming it and creating a new one. It's job should be to aid in hal and similar abstractions and to assist in the configuration. Having it stay away from the main application and usercode would be good.
Maybe an option to use it in library-mode would work?
The way it is now, it is only useful for the initial setup and after that it is a huge liability and incompatible with version control systems like GIT...