How does bitcoin find the block locator hashes in the leveldb database?
The answer is that it doesn't use LevelDB for this.
It has an in-memory data structure with all known block headers, each pointing back to its parent. It also has a vector with pointers to all block headers in the currently active chain.
To build locator objects, it simply looks in this vector at specific indexes.