I really like the Moodle plugins directory: Ad-hoc database queries plugin for any kind of custom reporting. There's lots of examples available https://docs.moodle.org/402/en/ad-hoc_contributed_reports but usually the moodle data structure isn't too hard to work out.
This is more for creating your own reports. I find it easier than maintaining core code customisations, which is also possible of course.
I have finally opted for hacking the plugin, so if it eventually breaks, I might try your suggestion