If you used the import source “Director Hosts”, as I described in my last post to your other question, then you should be able to read this variable in the x509 service import and discard the rows with check_x509_certificates = false. In the same way the rows without a matching host got discarded.
Use the preview in the “Director Hosts” import source to understand the data structure to get at the variable from the x509 service import.
An alternative would be the regex filters in my import but I should replace those with your idea, so my users can manage this variable on their hosts and don’t need me for this.