This function contains the logic that determines whether the check step
will be skipped for the current pkg, taking into account `make_check`.
Use this new function in `install_pkg_deps()` so that it uses a more
accurate condition to skip installing check dependencies.
For instance, check dependencies for a pkg with `make_check=extended`
will no longer be installed when using `-Q`. Similar for `make_check=ci-skip`.
Replaces: #46207