[VersionControl] Fix concurrency in query.

When we did a recursive=true call, we didn't use the query thread, which
caused multiple entries in native libraries.
This fixes it so recursive=true will make the caller wait for the query
to finish.