Tasks used to be eligible as a target for setVariable/getVariable and are still documented as such (https://community.bistudio.com/wiki/getVariable).
I used this in some mission designs but they are now throwing an error when trying to call getVariable. setVariable seems to be fine.
[Edit]
Per Killzone Kid's note, getVariable against a task apparently doesn't support an array (so key,default) argument. I've updated the steps to reproduce.