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

Are you certain? The last time I looked it was more like
“meet criteria → Badge granted”
“meet criteria → TL group joined → TL Badge granted”
but not
“meet criteria → Badge granted → custom group joined”

I’ve often thought a “group query” feature would be nice, but as troublesome as the badge query feature can be, perhaps it wouldn’t be the best idea.