I'm not experienced with GTK, but my understanding is, that GTK itself is very much a graphics toolkit. It is the very part, which requires a graphics backend to work. There are other stuff which does not require that, and they are put in GLib.
Qt is much more general purpose toolkit, it has a lot of features built in, for which you'd use some other library if you had a GTK GUI. With Qt you can build application which does not require graphics backend, but you have to create the application object instance from QCoreApplication
class. If you have a Qt application which uses QApplication
, and you try to run it without having graphics backend, you get error too.
Reason is practicality and keeping things simple, and perhaps also just having a suboptimal design, which makes separting some things from graphics backend difficult. A lot of things really depend on having the graphics backend, and adding special cases for situations where there isn't one can be seen as extra complexity (==work and bugs) for little benefit.
As to 2nd part of your question, I don't know a workaround for GTK, other than, don't use it if you don't actually mean to draw anything. But I think generally, you would need to provide a "dummy" graphics backend, which can satisfy the requirements without actually having a screen.