Safari lets extensions precompile a list of patterns to block and then it does the actual blocking. The extension never sees your browsing history or network requests.
Safari also has a limit, and it's low enough that plugin developers have had to split their work into multiple parallel plugins or even into standalone macOS applications.