[VersionControl] Never invoke VCS queries with the lock held

The purpose of this lock is purely to provide threadsafe access
to the collections holding the version control queries. We should
not execute any query with that lock held as that will result in
the IDE hanging until it has completely executed all VCS queries
in the current batch.

I kept the current intent of the code while respecting the semanatics
of the lock by duplicating the collections while the lock was held.