Never return the internal module name as a mutable string. #5481
This duplicates logic in `to_s` that dups the module name before returning it, but also ensures that any cached module name is frozen so it can't be modified in place. Fixes #5480.
@enebo I didn't see any evidence that we froze it, but it makes sense to do so. That inner method was added by you in 9.2 so it seems safe enough to make it now return a frozen string reference.