The Workshop Script don't get touch so the entries there remain and that are the entries that are important.
I don't think that's actually true. While you are correct that you didn’t change any of the workshop scripts, you
did change one of the values for one of the primary variables the scripts use to do their calculations in a way that wasn't intended.
Based on what I can tell so far, when you first start Fallout 4, the game saves a list variable called, appropriately enough, “WorkshopMasterList", which includes an array inventively called “Workshops”. This array appears to be empty when you first start a save, and is added to as you take control of settlements.
From what I see, as you take control of a settlement,
WorkshopScript runs a function called
InitWorkshopID which appears to create a new workshopID for the settlement. Then,
WorkshopParentScript runs an event called
OnStageSet that updates the array called “Workshops” by adding the new workshopID and then assigns an instance of
WorkshopScript to it. It also sets the settlement to “owned” by you.
That’s why you had to do the quest. By removing what you did with Fallrim Tools, you forced the game to re-generate a new workshopID for the settlement. This started the process I just detailed over, and you had to re-take the settlement.
The concern I have is that we don’t know if the engine has any provision to
remove the old workshopID from “WorkshopMasterList”. Given what I’ve seen so far of how the various lists are generated in the parts of the code I’ve been looking at and what I know of human nature, I highly doubt it. Once generated, I haven't seen anything that would remove a workshopID. Even if you lose a settlement due to low happiness, it still retains its workshopID. It's just set to “not owned”.
I worry that most of the daily update functions that the workshop scripts use will iterate through the “Workshops” array and try to run themselves against the old workshopID’s values, as well as the new one.
In your case, there is possibly a “dummy” (for lack of a better term) workshopID in the “Workshops” array. When any of the daily update functions try to run against the resource numbers for this workshopID… I don’t know what they’ll do. They don’t seem to have been designed with this possibility in mind.
Like Kinggath said, we need to know more about what information is stored in the save file, and what engine-level error handling or clearing the engine does, before we can say this is an okay thing to do to recover a lost settlement.
Hopefully that makes sense, and I'm not missing something.