CSD header bars have a border at the bottom with 1 pixel in size which has a different color than the menu or header bar.
As a workaround one can set this code into ~/.config/gtk-3.0/gtk.css:
headerbar {border-bottom-width: 0px;}
I tested this with Xubuntu 21.04 which ships with Gtk version 3.24.25.
The picture below shows mousepad version 0.5.5:
