internal/postgres: move latest-version insertions last
internal/postgres: move latest-version insertions last

Reorganize the code of saveModule so that all changes that assume
we have the latest version happen at the end.

Change-Id: I53b261f1fc24bd48001542b4f0e1d6bbc5f75d29
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/760099
CI-Result: Cloud Build <ea5729d4cf3392b9d382b6ca272c65aa27554f44@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <e6cb64861edcc38971590ff27c111e0e672de045@google.com>

golang/pkgsite,golang/pkgsite,golang/pkgsite,golang/pkgsite