The “WindowManager is capturing your screen” notification appears to be associated with Mission Control or Spaces on your Mac.
You have reproduced the behaviour when using Mission Control or switching applications, and, importantly, it stops when Displays have separate Spaces is disabled.
Other macOS 27 users have reported the same notification when switching Spaces or using Mission Control, including a report involving a 14-inch M1 MacBook Pro with two 4K external displays.
There are also reports that the behaviour was not present in macOS 26. These reports are useful supporting evidence, but they do not establish the cause.
Apple documents Displays have separate Spaces as the setting that allows each display to have its own Spaces. Apple — Use multiple spaces on Mac
For now, the simplest workaround is to turn off Displays have separate Spaces under System Settings >> Desktop & Dock >> Mission Control.
The disadvantage is that your displays will no longer have independent Spaces.
If you want to keep the setting enabled, I recommend reporting the behaviour to Apple through macOS Product Feedback.
Include your Mac model, macOS 27 version, two 4K displays connected through a Thunderbolt dock without DisplayLink, the circumstances that trigger the notification, and the fact that disabling Displays have separate Spaces appears to prevent it.
Based on the available information, it is reasonable to regard this as a possible macOS 27 regression involving Mission Control/Spaces and multiple displays, rather than assuming that the Thunderbolt dock or displays are responsible.
The specific cause has not been established.