That's likely a firmware bug in the monitor. It probably reports some ridiculously small resolution during its boot process and macOS queries it that time and rearranges the windows accordingly.
macOS could implement workarounds of course, but probably it just follows the process whatever the display id protocol prescribes...
I'm thinking of flipping my monitor upside down so I'll never accidentally brush that area while picking up something on the table.