UBlueprintEditorLibrary::RemoveUnusedVariables removes (object) variables from a blueprint even if that blueprint graph had Event nodes that are bound "inline" to that object variable. For example: a primitive component's OnActorBeginOverlap can have an event bound to it by right clicking the component > Add Event. RemoveUnusedVariables will not consider that and still remove it.
Expected: an event being bound to it "inline" i.e. via "right click > Add Event" will make the variable treated as in use.
User's repro steps:
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-197140 in the post.