Factory resetting will not revert your OS back to an earlier version. Whoever gave you this information is completely mistaken. Every firmware update is saved in a specific part of your phone, which is used for resetting your device upon a factory reset. If all you did was factory reset after installing OneUI 7, you will still be on OneUI 7. If you aren't experiencing the "freezing" issue anymore, it means whatever customisation, widget or apps you had running previously, is likely removed.