There is an auto-white balance script that works like this: you sample something that should be neutral gray (R=G=B) in the image, and it applies a global correction to the image so that it is indeed neutral gray:
http://luca.dealfaro.org/photography/WhitebalanceHowever this is an old script that is designed to work with the gamma-corrected processing done in Gimp up to Gimp 2.8, It still works in 2.10 (because Gimp simulates 2.8 color processing in to scripts) but it shouldn't be necessary, since you can do pretty much the same thing directly in Curves now.