I’m not sure why you think you would need to give away the whole game for mods. You need only distribute header files and a pre-built library if you want mods to be able to link directly to your own module.
That is of course assuming the mod requires building C++ code. With new features like Blueprints and a data-driven workflow, that might not be necessary.