Hi,
I own an old 7T and played a lot with it. I probably caught some bad piece of malware at one point because one day the battery was drained like hell and it became slow. I did some factory resets but it did not help.
But I don’t think factory resets were enough, because after a reset I’m asked for my previous screen lock. It lets me think that not everything is wiped. My malware (if any) could survive a wipe…
How can I better clean all bit of data/code on my OP7T like a complete hard disk formatting? And then get the old stock ROM installed on this blank space
One explanation might be that all accounts, especially any Google account was not removed before Factory reset. I would concentrate on this before diving deeper.
Is the phone on /e/OS or OxygenOS or something else at present? You may get inspiration from this thread https://community.oneplus.com/thread/1541327 but Android does not make your proposal especially easy!