You put when: on an import_tasks. What does Ansible actually do with that condition?
It copies the condition onto every imported task, and each task checks it again just before it runs.
An import disappears during parsing, so a keyword written on it has nowhere to live except on the tasks that replace it. Ansible therefore adds the when: to each imported task. Nothing is checked once for the import as a whole: it is checked once per task, at the moment that task is about to run.
Most of the time this gives the same result as checking once. It differs when the tasks themselves change what the condition depends on. If the first imported task sets a variable that the condition tests, the later tasks see the new value and may be skipped. The next card shows that trap.
The same inheritance applies to other task keywords on an import, such as tags: and become:.
Go deeper:
Conditionals with imports (official docs) โ the set_fact / debug example of a condition copied onto every imported task.