Widget Blueprints that are only referenced in code are not cooked correctly

Wow, it’s amazing!
Not sure if this is sarcasm…

Base native classes are derived directly from UUserWidget. Base class is set in blueprints with Graph > Class settings. Works fine in editor, but refuses to package (Class not found errors). Tried casting to UBlueprint and UClass with and without _C suffix.
Anyone else been here and solved this problem (was on 4.7.6, now on 4.8.2).