Defenses have disappeared in a settlement
Solution 1:
It appears that this is just a random bug that has no definitive cause or fix aside from reloading a previous save. I was able to find this Reddit post and this thread that described issues similar to yours.
Unfortunately, it looks like at this time, the only way to fix this is to reload a previous save when it happens while you wait for a patch, as I haven't found any evidence that one has been released to fix this yet.