So fyi, the way you hook it there is what makes the preview flicker in System Settings.
You check if the screen is locked, and if not, kill the host. But screen is not locked in System Settings. So basically, you're killing the host process every 2 seconds (and macOS, at least in Tahoe, restarts it, it doesn't in previous macOS versions).
That's also what causes your issues with "Options" not working (because you killed the instance that was linked to that button). The way we workaround it usually is to hook a system event.
You can check https://github.com/AerialScreensaver/ScreenSaverMinimal
Look for handleWillStopNotification and com.apple.screensaver.willstop