When I extend the second screen and move the software to the second screen, and then cancel the extension screen, the software will not automatically return to the first screen
That sounds like a valid bug. What OS is this on?
On Windows, there’s a variety of ways to bring “out-of-screen” windows back. My favorite is Win+Tab, right click on the window -> Snap left/right.