Can an extension remove its custom fields on uninstall?
Your extension needs to include an Upgrader class containing an uninstall function. In there you can use the api to delete the custom fields and custom group. Generate the Upgrader class in civix using the command:

civix generate:upgrader


Read more documentation on this at https://docs.civicrm.org/dev/en/master/extensions/civix/#add-a-database-upgrader-installer-and-uninstaller