Cleanup and optimize Position::has_mate_threat()