The `needs:` does not filter dependent artifacts

Summary

For:

build-a:
  stage: build

build-b:
  stage: build

test-a:
  stage: test
  needs: [build-a]

test-b:
  stage: test

The test-a will receive artifacts from build-a and build-b where it should only from build-a.

This is due to not persisting needs as part of metadata.

Introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31328.