This could well be because ufw is using nftables (natively or via iptables) and blocking LXD’s networking.
See