There's no way to localise a change in drawing mode. I guess you could globally store whatever the default is on start, and then track every change.
But the API already knows the current mode.
If it returned the previous mode when calling setDrawMode(), code could then make temporary changes before restoring it.
E.g.:
LCDBitmapDrawMode current_mode = playdate->graphics->setDrawMode( kDrawModeInverted );
// ... draw an inverted bitmap, e.g. pressed button
//restore draw mode
playdate->graphics->setDrawMode( current_mode );
Right now I have to guess the previous mode was kDrawModeCopy. It's dodgy.