build-matrix: use $(words $(BUILD_PKGS)) instead of counting

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Fix counting of build-only packages

Signed-off-by: Timothy Gu <timothygu99@gmail.com>