I've been looking at this and have a working solution, but I have to make some compromises on the geometry of restoring the maximized window. Since the monitor that got removed may have had a much larger resolution than the current monitor, I think it's best to restore the window to the top left of the workspace since it's conceivable that it could restore somewhere far to the right and/or far to the bottom and still wouldn't look right. Also, if the restored window is still larger than the screen even with the window positioned at the top left, then the window will be shrunk to fit the screen.
I've been looking at this and have a working solution, but I have to make some compromises on the geometry of restoring the maximized window. Since the monitor that got removed may have had a much larger resolution than the current monitor, I think it's best to restore the window to the top left of the workspace since it's conceivable that it could restore somewhere far to the right and/or far to the bottom and still wouldn't look right. Also, if the restored window is still larger than the screen even with the window positioned at the top left, then the window will be shrunk to fit the screen.