Yes, this, exactly. It's mind-boggling you can't do this. (You can kind of, sort of approximate it w/ do-not-disturb mode, but turns off other notifications too, unfortunately. It needs to just be a separate option. I have zero interest in picking up calls from non-contacts in real-time.)
There are Android apps that block calls from non-contact numbers. Including open-source apps on GitHub. Maybe there are such apps for iOS also? It baffles me that this functionality isn't built-in.
edit: Nevermind I can block non-contact calls in Do Not Disturb mode in the LG phone I'm using: https://i.imgur.com/ZcRSXlK.png Maybe iOS DnD has this too?