Persistent malware despite factory resets
You can try identifying the app the next time it brings up that popup by checking the foreground activity using dumpsys:
adb shell dumpsys activity activities|grep mFocusedActivity
OR
If it's just a window without an activity use adb shell dumpsys window windows and search for apps whose windows have isReadyForDisplay()=true, this may help you be able to identify exactly what app is responsible for the popup so you can disable or remove it