Okay. After long 40 minutes of struggling, I managed to make Darktable work with Gimp.
I've tried installing Gimp with flatpak, removed Darktable from snap and installed the latest one from a ppa (personal archive). It did not work.
It seems that the gimp packages coming from snap and flatpak are completely broken but the reason is probably nobody uses them at all.
Even though flatpak is the "recommended way" of installing Gimp I would strongly advise against using it at all, simply because the packages coming from there are completely unusable out of the box.
(Gimp's contributors probably need to update Gimp's homepage because they are currently providing incorrect info.)
Once I installed Gimp from this ppa everything happened flawlessly:
sudo add-apt-repository ppa:otto-kesselgulasch/gimp
I can confirm that Darktable from ppa:pmjdebruijn/darktable-release and Gimp from ppa:otto-kesselgulasch/gimp work correctly together.
These were probably some internal configuration problems of Gimp but the thing is most open-source contributors are happy with "works on my machine" which is the case with Gimp sadly. No users should have the study the internals of an application, so they can configure it properly.
P.S I thought that during the years the standards have become higher in open-source development but they might have actually got lower. We as users are about to expect unhappy years of struggling to complete simple tasks with Ubuntu because of this attitude. This is the fact.