Only:changes does not consider failed jobs in previous commits

Only:changes does not consider failed jobs in previous commits

For example; you configured a ‘build’ job that only runs when a Dockerfile is changed with

build:
  stage: build
  image: /docker:23.0.1
  script:
    - docker build .
  only:
    changes:
      - "Dockerfile"

For every commit that has changes on the Dockerfile the job will run.
In the case the job fails another commit without changes to the Dockerfile could be pushed and a new pipeline will be created without the ‘build’ job and could succeed.

I would like a safeguard that ensures that the last ‘build’ job run has succeeded before being able to merge a pull request.
Or ensure that if the previous run of the job failed it is always included in future pipelines.

is there a built-in way to make this happen?

MR pipelines run for all changed files even from older commits in the MR.