CModule::setModules() fixed to not override existing moduleId aliases

orginal commit by @klimov-paul in #2931

close #2931, fixes #2917