I beg to differ. Treaties are only needed when wars are fought. Many nations (e.g. Panama) came into being simply because some global power decided to accept (and possibly rig) a voter referendum.
In the case of Panama, the US wanted a canal, but the Colombian government would not allow it. Hence, we started a revolutionary movement, quickly granted recognition, signed a treaty with our installed puppet government, and built the canal anyway.
Panama was a war (revolution) and then a treaty.