The ipv4 filter is not a name resolution filter. It simply tests if the passed string is a valid IPv4 address.
If you want to resolve a DNS address you probably should be using the lookup plugin 'dig'.
https://docs.ansible.com/ansible/latest/plugins/lookup/dig.html
Example
$ ansible localhost -m debug \ -a 'msg={{lookup("dig","www.google.com/a",wantlist=true)|first}}'localhost | SUCCESS => {"msg": "172.217.14.196"}