When you first create a course, you have the opportunity to rename the roles. Any entries you make are ignored. New role names are only applied when you update an existing course.
Steps to reproduce:
1. Go to /course/edit.php and create a new course
2. Rename some of the roles
3. Submit the form
Redirect to /admin/roles/assign.php, which lists the roles with their new names, and the old names in brackets.
Redirect to /admin/roles/assign.php with only the default role names displayed.
This is because create_course() in /course/lib.php lacks the code to handle role renaming. It does exist in update_course(), so I copied it from there (with some minor modifications). Please see the attached patch.