A very stupid bug that has been there for quite a while! Luckilly the fix has been released recently into the proposed repository for both Bionic & Cosmic (Disco as well).
Just enable the proposed updates from Software & Updates -> Developer Options -> Pre-released updates, then run the following commands:
sudo apt update
sudo apt install gnome-shell-extension-ubuntu-dock
Hit Alt+F2, write r and then press Enter (works for Xorg only, not Wayland)