How to prevent traefik from falling back to another matching ingress on 503?

is there a reason you created two different ingress objects?

You can just create multiple paths for such a use case and I'm not 100% sure, but I think this might also fix your issue:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
spec:
  ingressClassName: traefik
  rules:
    - host: "example.com"
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: b
                port:
                  number: 8080
          - path: /api
            pathType: Prefix
            backend:
              service:
                name: a
                port:
                  number: 9090