Commonly, that warning can be ignored, e.g. if it would be caused by some few stray requests originating from your router's public IP.
But you didn't supply a debug token as requested by our template.
Without a token, we cannot assess your observation.
Please: Do not modify that file!
In addition, I doubt that to be a solution.
At the very least, I can guarantee it won't be permanent at all.
This is prominently disclaimed at the top of 01-pihole.conf.
# FILE AUTOMATICALLY POPULATED BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
If your Pi-hole is receiving traffic from remote public IP addresses, you would have turned it into an open resolver, which poses a potential threat for all Internet users, e.g. by serving as a multiplier in a DNS Amplification attack.
The Pi-hole team strongly discourages Pi-hole’s usage as an open resolver, and we won't provide support in that case.
IP-based access control cannot be considered safe.
The recommended way to operate a Pi-hole accessible from a remote location would be via a VPN, closing port 53 to the public - your may refer to Pi-hole's Docs at Guides | VPN for further suggestions.
I also think your original issue can be addressed via Interface Settings in Pi-hole's UI, instead of tampering with Pi-hole's configuration files.