NATO’s new chief will have to confront threats outside the alliance — and within