The answer ist to instruct these persons to restore the state they are changing after they have done their part. glPushAttrib() anf glPopAttrib() will help them.
Alternativly, you can call glPushAttrib(GL_ALL_ATTRIB_BITS) before you call any of these functions and glPopAtrib() when they return. But this can be easily become a performance bottleneck if done many times per frame.
Textures are objects too. And the binding for each target push/pops. But not for framebuffer or renderbuffer objects.
If you need to restore the FBO that was bound before you called some library function (or equivalently, before your middleware implementation returns to a client) then you need to GetInteger and re-bind it yourself.
The point here is that middleware layers already can’t rely on push/pop for state management.
Same story goes for program object binding, XFB buffer bindings, and uniform buffer binding.