Try set custom spamassassin score for dkim and spf rule and let spamassassin quarantine/block it.
It work for me. This is my /etc/pmg/spamassassin/custom.cf and test email from gmail.
Received: from pmg.mydomain.com ([192.168.40.106])
by mail.mydomain.com with ESMTP; Tue, 13 Sep 2022 08:54:48 +0800
Received: from pmg.mydomain.com (localhost.localdomain...
18.104.22.168 is being blacklisted.
status=bounced (host mx-biz.mail.am0.yahoodns.net[22.214.171.124] said: 553 5.7.1 [TSS07] Connections will not be accepted from 126.96.36.199, because the ip is in Spamhaus's list; see https://postmaster.yahooinc.com/error-codes (in reply to MAIL FROM command))