Don't run pkg.refresh_db before checking targets

In 5a95286, a call to pkg.refresh_db was placed before the function that
checks to see which targeted packages need to be installed. This was
done specifically to make newly-added repos available to pkg states in
the same highstate run. This commit moves the refresh_db to the pkgrepo
state instead.
Merge pull request #9469 from terminalmage/issue9341

Don't run pkg.refresh_db before checking targets