You can't change the service name with a plugin, but you can define custom service names in the settings. Here is the Documentation. The service names are highly configurable that way.
What would be the use case to do it with a plugin, and not in the settings?
Oneagent SDK does not have such feature at the moment. Maybe @Jakub M. will share if is this on the roadmap. Currently you can use Oneagent SDK for sending metrics just for process groups and hosts and do alerting on those metrics.