Which resolves first during a build, `pkg_deps` or `pkg_build_deps`?

We just ran into an issue where a package in pkg_build_deps resolved to a very old version of a package, whereas we were correctly resolving to a recent version in pkg_deps. Since the most ‘important’ packages are those for runtime (pkg_deps), it seems like we’d want to resolve those first during the build? Or are we misunderstanding how dependency resolution works during builds?

From what I can tell, build deps are resolved first, then runtime deps.

I have no idea if this order is arbitrary or purposeful. @fnichol likely has some helpful context on this one.