If one were to ask what they could have done in order for Russia not to invade Ukraine, how can such a question get a meaningful answer? Or to put it differently, what are the conditions for the answer to be truth-functional, i.e., to be true or false?
The answer is game-theoretic. Chess is a good example, which I think is also used implicitly by Robert Aumann, but I may be wrong. In any case, there are three phases in the game of chess. There is the opening, the middlegame, and the endgame. They present different challenges to the analyst.
In the opening, the aim is clearly defined for both sides. In the Yugoslav chess theory, which Bobby Fischer adopted, I think, the advantage gained in the opening stage of the game will lead to the desired outcome in the game. And the advantage is clearly defined in terms of the control of space, of the centre mostly, and in the full development of the pieces. So, when analysing a game post factum the analyst can meaningfully claim that if this move was made rather than the one that indeed was made, the outcome would have been more advantageous – whatever the opponent did. So, that counterfactual is truth-functional.
Applied to the Ukrainian case, that means that Ukraine should have been accepted into NATO in 2008. Other choices do not give advantage to Ukraine.
In the endgame, Zermelo’s Theorem applies. If players make their best moves, the outcome is completely predetermined. So, the analyst can always evaluate every possible move and judge what outcomes they would lead to. All counterfactuals are truth-functional in the endgame.
Applied to Ukraine, Russia clearly should not have aimed at occupying the whole of Ukraine and that implies that it should not have invaded the country at all.
In the middlegame, counterfactuals are not truth-functional. While it is clear what the aim is, there are no best moves or responses irrespective of what the opponent does. If there were, the players would move directly from the opening to the endgame. And because there are no best moves no matter what the other side does, and there are many correlated equilibria, the analyst can go back and perhaps identify the wrong move in the actual game as it was played, but not the best move, certainly not in that game overall, let alone in the game of chess in general.
So, applied to Ukraine, one can say that the 2014 annexation of Crimea by Russia and the opening up of frozen conflicts in Donbas was a mistake; one cannot argue that the same mistake might not have been made had Ukraine declared neutrality or done whatever else is now being claimed counterfactually would have prevented the current Russian aggression.
More generally, we basically cannot learn from history. Or even more generally, induce truth-functional counterfactuals from data. In chess, the opening and the endgame somewhat discipline the middlegame. There is nothing similar in the games of history and politics.