Even if you don't do dealings with shady registrars or TLDs (.af was a fun TLD until the Taliban returned to power...), you can lose your domain. For instance, lots of British people lost their .eu domains when they were no longer EU citizens thanks to Brexit.

On the one hand, using national TLDs can be a problem if the area you live in is no longer considered part of your country (I imagine .ua owners may have that problem in the future with the way things are going). On the other hand, using TLDs like .com/.net/.ai/.io puts your domain under control of foreign law enforcement (US for .com/.net, UK for .ai/.io).

It really ought to be standard that people who already have domains when something like this happens retain them.

It looks like .io will change jurisdiction. Another thing to consider with regards to jurisdictions. There is a good argument for you own national TLD.

That said, a lot of ccTLDs are not that restrictive. Anyone can register a .uk for example (so, Scottish nationalists have one less thing to deal with in their plans).

In the case of Ukraine they will probably want to allow people in any territory they lost to retain .ua domains as a way of maintaining a claim (that is assuming their rules are restrictive in the first place).