onBeforeSaveUser vs onSaveUser
The problem is that both onSaveUser and onBeforeSaveUser get fired from UsersService->saveUser() and user group assignment happens in the UsersController->actionSaveUser() after UsersService-&gt;saveUser() has already been called.

You should probably be using onBeforeAssignUserToGroups and onAssignUserToGroups instead.