The easiest way I know to reset roles and their associated capabilities is to use wp-cli.
wp-cli has a built-in method for resetting roles. You can specify any that you want to reset. For example:
wp role reset author contributor editor subscriber
There is also an --all
flag, which you can use like this:
wp role reset --all
Warning that this will include resetting the administrator capabilities, which may remove access to some plugins, so use with caution.