We want the option to backup only some of the role assignments on a course (that is, all the teacher-ish roles, of which we have lots) but not students.
I think the way to do this is another section at the bottom of the backup form: 'Backup role assignments for roles', with a checkbox for each role. The are disabled if you choose to backup with no users.
This information is stored as an array of role ids in the backup preferences, which is then used to filter the list of roles used in the for loop in write_role_assignments_xml() in backuplib.php.
This does no at all affect the selection of users to include in the backup. This is entirely separate (and totally horrible code) so I am not going to touch it.
I think this might be generally useful, so I will put it in core.