sys.exit()
and the Java equivalent aren't designed to return early from a method, they're designed to end the execution of the program, and the only reason your Ignition Gateway / JVM doesn't cease to exist after that is because we've hooked into prevent it.
It's not meant for what you're using it for.