Well,
SquidLord69 you're not wrong but there's more to that, it's also a PR thing, recognize the Capcom debacle that's going on right now?, their "war on mods" thing, while mods are ussually seen in a good light for the public it's also a liability specially if it opens up the chance of the studio or publisher to being sued; Say some moron decides to hide malware in a mod, it's complicated but .dll mods can do, then hell lets loose and becomes an internet shitstorm, now you're implicated since your game is modable and in a way you provided no "safety measures" (even though a rational person would have themselves accountable ofc), or imagine the "moding Keanu in CP2077 to have sex to him" dilema, yeah sure not CDPR's fault, but you didn't outlaw the possibility and someone has to be responsable.
TL;DR: By stating that mods are a violation of the ToS is just a way for studios/publishers to cover up their own ass, and to be honest, their finantial investment into legal expenses that come from suing a moder just to snatch a few grand out of them is not even worth it, and very little amount of companies would do proced with legal actions... That's more for cheater like the recently won case from Rockstar that crushed a cheat-creating company, look it up, it was wild.