Manual:$wgRemoveGroups

remove

Details
If a group can remove any right (example: bureaucrats can remove any right):

If a group remove only some rights (example: bureaucrats can remove only sysop and bot groups):

Note that groups which may only grant some rights (like bureaucrats in this example) need to have the userrights privilege set to false, otherwise they will still be able to remove all groups.

You can also define $wgRemoveGroups in a way that does not overwrite an extension's definition: