Happens to me, too. On Firefox and all Electron apps. Drag the window to the left or right edge, or the top-left or top-right corner. Then move the cursor to the screen edge (not limited to the top edge, just any screen edge the window touches), the cursor changes to the “resize” shape. Then one click and the window restores to the previous position and size.
Seems some Gnome apps (e.g. Minder) don’t have this problem, despite they also use CSD. The cursor doesn’t change on the screen edge. Seems they have special treatment on screen edges. Their round window corners become square when touching the screen edge.
The weird thing is some GTK4 apps (e.g. EasyEffects) have the problem that when tiled, all window corners become square, and you can’t resize them using mouse at all.