Hey I live at 2 different locations, both of which offer an external display at different places on the table. Whereas everything is perfect with the display that is located above the laptop screen (Dock stays on the laptop screen) the other display forces the Dock onto it (off the laptop screen) as it is located left from my MacBook and I think that is the reason why the Dock moves there.
Unticking "Displays have separate spaces" deactivates other stuff like split-view and placing the monitor that is physically on the left to my MacBook above my MacBook in the arrangement window is simply too confusing for me to handle.
Putting the dock to the right is out of question as my "Touchpad mobility" is quite restricted which makes every move to the right side of the screen extremely uncomfortable.
EDIT: Just wanted to clarify the dock position. Below is the working one where the dock is on the side to the external screen, the one above shows the rather awkward position right now.