Safari[0] has this and has had for a while now...
While maybe not as effective as uBlock Origin, I have extensions I use that leverage that API on iOS and MacOS that do a good enough job for my needs.
[0] https://developer.apple.com/documentation/safariservices/cre...
However, this API could be used to optimize some of (not all of) the networking filtering that uBO does. Network filtering is distinct from cosmetic filtering, the latter is what injects scripts into every page. The uBO wiki has some nice documentation of the different features, measurements of their overhead, etc. E.g.: https://github.com/gorhill/uBlock/wiki/Doesn't-uBlock-Origin...
I know a lot of web developers don't want to hear this, but throwing more javascript at the problem isn't always the best solution.