Fix race condition due to call of `Tree.symbol`

Calling `askOption` directly in the traverser is extremely expensive,
therefore it should happen as less as possible. Because the check if
the symbol exists is only necessary for dynamic types, which are not
used very often, it is only done when no other information in the tree
could be found.

Fixes #1002132