An incorrect removal of a conditional resulted in include_tasks falling through to the old static detection mechanism incorrectly. This restores the previous conditional check. Fixes #31593