What is the best way of avoiding style-compat.css of being injected on my custom theme?
You don't. The whole point of that file is that Vanilla needs a way to add CSS for new platform features, but the bootstrap3 theme (which along with its derivatives was very popular before keystone) did not use style.css.
When we added Category Following & Rich Editor we needed a way to add additional core CSS that would apply into every theme.
We have a new strategy going forward, but that's why style-compat is there.
Why do you want to remove it anyways?
Wouldn't it be better to set it right on the plugin? I disabled rich editor and see css being injected / changing my theme. I commented the line I linked above on the OP..
CategoryFollowing is a core feature.
More cleaner (though still a hack) would be to add a LegacyAssetModel->removeCssFile() method like it is implemented in Gdn_Controller.
Then you would be able to hook into legacyAssetModel_afterGetCssFiles and call $sender->removeCssFile.
If you would create a PR for the additional method in the LegacyAssetModel, it might get implemented and you will not need to use any hacks in the future.
Did you disable the rich editor plugin or just change your formatting method?
We have something similar going on. Our old forums used bbcode, so the ones migrated to Vanilla were set up to use bbcode, Advanced editor and a custom theme from scratch to keep the user experience familiar. I have zero use for the new rich editor or keystone features right now, but obviously need the security patches.
That being said, in our case style-compat.css only made a few weird margins, and they were easy enough to override in the theme.