Makes listify_lookup_plugin_terms respect the global setting for undefined variables.

(Fixes #9008.)

With credit to @jimi-c for the initial pass: https://github.com/jimi-c/ansible/commit/b18bd6b98edecda1fcb5a85053593e78b46b9709