You probably can't assume the renderer will be OpenGL. For example unity games can be built for all sorts of different targets, it may end up running on DirectX or Vulkan.
The complicated bit of building a UI toolkit is calculating how everything will get layed out, not the actual drawing. You could implement a simple routine in each engine that just draws a bitmap in a specific rectangle and collects user input, then the code to calculate where are the bitmaps should go on screen could still be common.