Sweden unwittingly executed a great strategic manoeuvre by surrendering all of Finland to Russia in that last war of theirs. That reduced Sweden's land border with Russia to a fraction of what it used to be. Later Finland became independent, which eliminated Sweden's Russian exposure completely. It's easier to maintain peace when you don't share a border with a chronically unstable aggressive empire.