Why wasn't the Mirage 4000 as it was put into production instead of the Dassault Rafael?
Too big, too expensive. Think of the 4000 as a F-15, and the Rafale as a F-18. Australia, Canada and a few others initially wanted F-15s but went for cheaper F-18s. Same for the engines: M53 is closer from a F100 when M88 is akin to a F404. Smaller engines allowed the airframe to shrink.
The Armée de l'Air repeatedly tried to get a french Phantom (Mirage IVC, 1958) then multiple F-111s or Tornados (VG strike: AFVG, G4, G8) then a F-15 (ACF, 4000): to no avail. The advent of the F-18, plus F404 and RB199 mid-size turbofans, provided a solution at least.
Rafale can be seen as a shrunk 4000 with a few additional goodies: different air intakes, more efficient canard, digital rather than analog FBW, a touch of stealth, plus a naval variant. Smaller size, more efficient engines.
Also (in theory at least) lower acquisition cost: because spread over more airframes: through arm-twisting of the Aéronavale and also a takeover of the full and entire fast jet fleet of the AdA (took 30 years since 1993, but we are getting closer: only the 2000 presently survives, all the others types have been send to scrap or museums).