Glad it’s gone, but wiping the whole drive was probably a bigger hammer than you needed.
Those “McAfee found a virus” messages are very often just scareware from a website, ad, or browser notification permission rather than an actual infection. Facebook ads can definitely send you to some sketchy pages.
If it ever happens again, I’d first check Safari’s website notification permissions, extensions and website data before doing a full restore. And definitely never click the warning itself.
At least the Time Machine restore got you back to a clean working setup.