Again. I think we are talking about different things.
1. Yes any ad network can cause a malicious pop up. Clearing cookies / history does nothing.
2. There seems to be another situation as in this case where these ads appear somewhat frequently from non sketchy sites. For me it would appear often on reddit. Which I believe uses their own ad serve system. I googled and searched Reddit because I was sure on a site that big other people would complain about it. But no one else complained about it. What I read (and don’t entirely understand) is that this ad issue somehow gets injected into your safari locally and to clear it you must clear the history. I know that sounds odd, but after clearing, it stopped happening on Reddit. So... shrug. Point is if you google around other people say it does fix the problem. It sounds weird and there’s may be a simpler explanation but the op should try that first.
It may be that the redirects randomly choose people/browsers and sets a cookie, which would also explain how clearing might make an impact. And also harder for site admins to track it down.
arn