Use replace for manipulating CourseLocator, so that deprecation is preserved

Whoops. I think the fact that `replace` actually creates a new key was what was confusing me.