It should not be a problem to just install and configure dnsmasq on the Raspberry Pi in addition to the access point.
Then you have to give its ip address to the devices that are connected to the access point. In the example of the setup you have used the Raspberry Pi (with the access point and the dnsmasq you have installed) has the static ip address 192.168.4.1. Now tell the DHCP server to give this ip address as DNS server to the connected devices. In /etc/systemd/network/12-ap0.network
just modify the line:
DNS=84.200.69.80 1.1.1.1
# to
DNS=192.168.4.1
Now the devices will use your DNS server.