

There are some package managers that do that.
Alpine Linux’s apk stores a list of required packages for the current system in a single file, /etc/apk/world. using apk add or apk del adds or removes a package from this list, then calculates how to get to that stage (adding all the dependencies, resolving conflicts…) and then installs the needed stuff (and removes the unneeded) to make it match.
The file can be edited or replaced using any other tools, then apk fix will do the same recalculation and installation/removal steps.

All the pop-up blocking that old web browsers had is still a thing. It’s just that most websites no longer make their pop-ups as separate browser windows that pop up via timed script, because that’s easily detectable and blockable.
Nowadays, they’ll form a pop-up using additional fixed-position <div>s, or form what’s functionally a redirect by creating what, to the web browser, looks like a giant link that opens up in a separate tab, or do other sneakier techniques, which are much harder to definitively detect as “a pop-up” and block without causing legitimate web pages to break.
As the web is becoming more and more a platform for full-on applications, you can’t really determine which functionality will only be used by ads or malware. There are projects like Gemini, which deliberately aim for a minimalist set of features that can only be used to deliver simple content with no intrusive additions, but these won’t serve as a complete replacement for the web.