Hello @PublicName,
Thanks for splitting this in to its own issue to keep the forums cleaner. I was able to talk with the proper people and this is going to be addressed. An issue has been filed here: https://github.com/elastic/beats/issues/20895 if you want to follow it. A better agent installer/uninstaller is actively being worked on.
As a workaround in the meantime, if you unenroll an agent from the ingest manager in kibana, it should cleanly uninstall agent+endpoint and any other enabled integrations.
Let me know if you have any other questions or need any additional help with it.
-nf