Mods can have licenses because they are considered separate works that interact with the original copyrighted work (in this case, Minecraft) through a legal mechanism such as an Application Programming Interface (API) or a modding framework (like Minecraft Forge). The mod itself is made up of original code written by the mod developer, and this code is considered the intellectual property of the developer, which they can license as they choose.
While mods do depend on the original software to run, they don't typically contain the game's source code itself. Mod creators write their own code that 'plugs into' the game without copying any of its original code, and this code is what they have control over and can license. The original game's End User License Agreement (EULA) and terms of service will often have guidelines as to what is allowed with regards to modding.
For instance, Minecraft's EULA allows for the creation and distribution of mods, as long as they are not sold for money. Here's what the EULA specifies about mods:
"Any tools you write for the Game from scratch belong to you. [...] Plugins for the Game also belong to you and you can do whatever you want with them, as long as you don't sell them for money [...]"
It's important to note that while mod creators can license their mods, they must do so in a way that does not infringe on the original game's copyright. For example, a mod that copies and redistributes the game's own assets or code would likely be infringing on Minecraft's copyright.
Many mods are distributed under open-source licenses, which often require that any derivative works (such as mods based on an open-source mod) also be open source and credited back to the original authors. Mod developers usually include a license file with their mod or post the license terms where the mod is available for download, detailing how their mod can be used, modified, or distributed.
Ultimately, while mods are derivative in the sense that they require the original game to function, the original content created by the modder is their own and can be licensed under the terms the modder chooses, as long as it complies with the original software's terms of use.