At work, I have a 2016 MacBook Pro running Mojave with two external Iiyama GB2888UHSU displays. The leftmost display is plugged into the rear left USB-C port, and the centre display is plugged into the front left USB-C port (and set as primary), with the internal display as the right display.
When unlocking the machine, it usually restores the displays correctly, but will randomly decide that the display in the rear left port is now the centre display, and the front left port now connects to the leftmost display. This makes mouse movement challenging to say the least, as well as moving the dock and the task switcher all the way off to the left.
Sometimes re-locking and unlocking will fix this. Other times I have to disconnect and reconnect one of the displays, and very occasionally the only thing that will convince the Mac to order the displays correctly is swapping the cables.
I don't want to have to drag things back and forth in the Displays>Arrangement pane every time this happens, and I don't really want to have to keep swapping cables back and forth.
Could the problem be caused by both displays being the exact same model, and not sending a unique identifier back to macOS? Do people have this same problem when using multiple external displays that are different models from each other? (My home Mac Pro with two displays never mixes them up — but the displays are not only different models, but one is connected with DisplayPort and one is connected with DVI, so it's easy for macOS to tell them apart.)
More to the point, is there something I can type at the command line, or some background program I can run, that forces a port to map to a particular position, so that the rear left port is always display 1, and the front left port is always display 2?