What went wrong
MonitorMate saves display layouts in profilesMonitorMate · The appProfile storeSaves each layout as a small text file. It finds the right one for the current setup by a fixed fingerprint for each display.See it in the MonitorMate build. It puts one back when the displays have been moved out of placeMonitorMate · The appAuto-fix rulesChecks what caused the change, the main auto-fix setting and the matching profile. Then it checks that no layout is already being applied, and that the displays really moved.See it in the MonitorMate build. Unplug a monitor and plug it straight back in, and the list of displays ends up the same as before. The reconnect may still have moved a display. But the final list gave MonitorMate no reason to check.
Why it happened
When displays change, macOS sends a quick burst of signals. So MonitorMate waits for a burst to settle before it acts. The part that does this waiting is the settle timerMonitorMate · The appSettle timerGathers the display signals from macOS for 1.5 seconds. It remembers if any of them came from a wake or a reconnect.See it in the MonitorMate build. A whole unplug and replug can fit inside one wait. The displays left at the end say nothing about what happened during it.
What I changed
While the timer waits, MonitorMate now notes the signals as they arrive. A connection flag means a display was connected or removed. A wake flag means the Mac woke from sleep. When the burst settles, MonitorMate passes the flags on with a fresh list of the displays.
A flag only makes the change worth checking. The checking is done by the auto-fix rules, the part that decides whether to put a layout back. Auto-fix must be turned on for the whole app and for the matching profile. MonitorMate must not already be moving the displays. And the displays must really be out of place compared with the saved layout.
If you move displays yourself in System Settings, there is no flag. So nothing is changed back.
What still needs checking
The code shows how the flags last through the wait. But reading code cannot copy the timing of every display, dock or wake. Four cases are worth testing on real hardware. The first two are a reconnect during the wait, and a wake that leaves the display list unchanged. The other two are a missing monitor, and a display moved on purpose.