Is it possible to create/manage Roles using a .yaml file?
User roles are defined in YML files called user.role.ROLENAME.yml.

Do a config export (drush cex) to get an idea how these files should look like (they will be written to your config/sync directory).

Then create your custom role YML files in my_module/config/install and they will be created when you enable your module (if you took a YML file from config/sync as blueprint, remove the uuid and default_config_hash keys)

The file should look something like this:

langcode: en
status: true
dependencies: {  }
id: my_custom_role
label: My custom role
weight: 1234
is_admin: null
permissions:
  - 'do fancy stuff'