Not exactly in the way of your example, but I have...
Several cases of
{$IF FPC_Fullversion=30202}{$Optimization NOPEEPHOLE}{$ENDIF}
To prevent a bug in the peephole optimizer from generating bad machine code for the units in question.
I also have several
{$IFDEF NOINLINE}{$INLINE OFF}
so I can define that for debugging.
I haven't run into any issue where I needed a debug session with some optimised, and some debug-able code. But if that would happen, it might lead to exactly your case.
I could also imagine specific other optimisation to be turned off (unconditionally) for some sections of code. Maybe
{$Optimization noORDERFIELDS}
Though I would likely prefer other methods (like embedding the relevant data in a record)