Can I create a plugin that checks users and grant access to group based on activity?

It looks like @Mittineague was right and there is no mechanism for automatically adding badge-earners to a group. You will need a custom plugin or an external program to manage the groups via the API.