Apparently, gtk3 supports an undocumented :backdrop selector that should do what I want under window managers that support the _NET_WM_STATE_FOCUSED extended hint. Sadly, it does not work on most window managers because most do not support that hint.
UPDATE: A patch is now available for Xfce's xfwm4 window manager.