The primary mechanisms for avoiding Dispel Magic are:

(a) Killing the opponent before it can act. The Pit Fiend is surprised with near certainty. Beheld does seems to have a theory that the fighter waste surprise rounds on Persistent Image. This seems unlikely both because a convincing Persistent Image can't be made without knowing the location of the target and because the Fighter has a Trueseeing in the Ring of Spell Storing. After a surprise round, the Pit Fiend has only a 17% chance of winning initiative. If it loses initiative, it is unlikely to be able to act.
(b) Attacking from beyond 300' range (with a -2 penalty). This does not apply to the Pit Fiend, but for a Titan (for example) which has no hide score, it's easy to spot at a 300' range and attack. Particularly if flight is used to attack from 300' above, the Titan cannot close the range effectively and so Dispel Magic is ineffective.

A Balor is a somewhat tougher opponent as it has a high spot and True Seeing. It is however still likely to lose the information war and hence be killed.

The Titan cannot survive under whithering fire from 300' range. It does however have the option of using Gate to escape as it takes several rounds of fire to kill it.

The Tarrasque cannot be truly killed. In the present build significant damage also cannot be inflicted so some Bane(Magical best) arrows need to be added to bypass DR 15/epic.

For good dragons, the primary plan is to not be in conflict with them. For evil dragons, Blindsense is actually more difficult than Trueseeing in core as there is nothing like Darkstalker to defeat it implying short range surprise is infeasible. Long range surprise remains feasible, but the relevant spells (Sorcerer 11 for a CR 20 Old Red) are difficult to predict. On the upside, a dragon has relatively low default AC. Overall, it's a tricky combat with an unclear outcome where it's easy to imagine Old Red teleporting away after suffering >200 hp of damage in the first round with an unclear outcome later.