Would it be up to code to use electrical box extender behind fridge that bulges out (California)?
Throw the box extender ring on there and roll
Since you have a metal box, the most straightforward thing to do would indeed be to toss the appropriate size extension ring on there and go.  You can also use a surface raceway starter box if you'd prefer, but those aren't available in quite as many sizes.  As to Code compliance? Well, Code doesn't care one whit if your boxes stick out from the wall, and even would let you wire a house entirely with surface-mounted conduit or raceway and surface-mounted boxes to match. Its only concern is that the box is not set back into the wall surface in a way that renders exposed wall surface materials vulnerable to sparks.