Well, yes, they can keep and operate them illegally. Short term: problem solved. Long term: its even worse.
It might be immoral, but surely keeping they planes will be legal by some means, executive fiat or whatever.
Is there international treaties covering such things?
Mind, I'm from the UK our government just ignore international law when they like and only to please their own ends, not even in times of crisis, so can't see something as simple as breaking a treaty will cause any change here.
Putin will make a law that returning airplanes to abroad is illegal. Foreigners have not been allowed to sell Russian shares already nearly a week. So nothing new there.
They cannot fly to most countries anyway, so the risk of getting them confiscated while landed somewhere is small.