Pihole can do this out of the box by going to the dns settings and adding a host. Alternatively, if your pihole is also your dhcp provider, you can set the hostname on each and pi hole should resolve it.
https://thiagowfx.github.io/2022/01/pihole-add-custom-dns-mappings/
No Way or alternatively Wrong Way