Looking at community.general/plugins/modules/lxd_container.py at main · ansible-collections/community.general · GitHub it seems to have the correct logic.
This change dates from 4 months ago, so maybe your system doesn’t have it yet.
You could look for lxd_container.py
on your system and then manually apply that part of the logic.