The documentation shows this as the prefered method: `with_items: "{{undefined_var| default([]) }}"`.
An empty list for the loop will skip the task, no need for `when`.
A strategy that does as you describe will have several issues, many `when` conditions will issue undefined errors as they expect the loop variable (normally `item`) or some other variable that derives it's value directly or indirectly from it. Since it can also be renamed via `loop_control` searching for `item` is not feasible.
This pattern was always an error, it 'worked' in 1.9 because a bug in ansible 'ignored' the exception, 2.0 stopped doing that and made it a fatal error. Since many users had this issue we changed it to a deprecation warning and scheduled it for removal in 2.2. Since this is a 'definition' error we are remiss to just 'skip' those as we cannot be sure that the `when` clause is meant to catch them or not. The conditinoals are also dynamic and not resolved until inside the loop, which is also the reason we cannot 'special case' defined/undefined conditionals, since they can be written many different ways.