As far as I know, you cannot create roles dynamically using the Role system entity. The entity and actions to do so are available, but it won't work properly.
However, granting/revoking roles via the User_Role entity is definitely possible. I've done it many times.