Issue #22246: WorkshopParentScript allows dead actors to be added to a workshop
Fortunately, this is not normally happening. The only case known so far is the quest Min02, which adds all minutemen that helped to clear out the mirelurks to the workshop - without previously checking whether they survived. WorkshopParentScript, which handles the addition of new actors, doesn't check this either, so the dead minutemen will permanently end up in settler aliases. There is no way to get rid of them because the scripts can handle dead actors only when they die while in an alias.
This is the reason why the dead minutemen at The Castle are never cleaned up.
To fix this,
(1) a check needs to be added to the AddPermanentActorToWorkshopPUBLIC function on WorkshopParentScript to bail out if the passed-in actor is dead.
(2) another check needs to be added to the OnLoad event of WorkshopNPCScript, to let dead actors kick themselves out.
(1) will fix the issue for new games, (2) is needed to make this work retroactively.