In the international law, is there any law or a principle regulating such cases like which resulting state must be a successor to the state that has just broken up and how the signed treaties with that non-existing-now state must be continued?
Yes, I think what you are looking for is the Vienna Convention on Succession of States in respect of Treaties
Disclaimer Please note that this convention is not ratified by many states, however it seems to represent a consensus of learned persons assembled under the auspices of the UN and based on "customary" treatment of these matters. Don't assume any of it can be enforced.
This information is offered for educational and entertainment value only.