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

Fixes #1002132

Not sure if this slows down semantic highlighting too much. Would it make more sense to wrap the entire `Traverser` in an `askOption`?