There was a similar request here about theme options Add option to clear all theme options
Both should be closed.
The last suggestion in this thread here, mentioning some tracking and additional logs created for each and every action done and taken in CP involving SQL would probably bring down every website using CP.
There are so many SQL interactions In a Dynamic Website or CMS that the log alone of those actions probably would take more space than the entire database would, even if leaving the dead data in there.
It is the job of plugins to clear up after themselves or offer options to do so.
There are plugins not doing that, for example, Elementor. They do not do that because “the user might later decide to install Elementor again and thus the data would be lost if we delete it on uninstall”.
In other words, this is actually both a good and a bad thing to do, and the right thing to do is giving the user the choice - inside the plugin or theme - to delete said data upon certain action taken (checkbox checked, button pressed, whatever)
I vote for closing this as an unactionable task that should live in the respective software and not within the core CMS