I don't want to do that with a blunderbuss, but perhaps there's an argument to do it for specific cases (search_path comes to mind, though the performance cost could be significant, since I think setting that in function SET clauses is common).
I suspect it became considerably moreso when we fixed the search_path CVE since we basically told people that doing so, despite the possible performance hit, was the easiest solution to their immediate dump/restore failures. But ISTM that because that SET has a function invocation context it could bypass any such check. Though maybe the DO command exposes a flaw in that idea.