Instances, pins and graphics have started to wander around the files. Sorts instances before writing. Uses compare with std::set (not std::multiset) to enfore lib item ordering Fixes https://gitlab.com/kicad/code/kicad/-/issues/17737