For the motivation see here: https://www.klayout.de/forum/discussion/2000/how-to-get-lvs-result-after-comparing#latest
Technically the reason is that using "LayoutVsSchematic::set_reference_netlist" with the same (already set) netlist again will delete the netlist object. Further down, the reason is that "WeakOrSharedPtr::reset" should take care of not deleting an object when the same pointer is set again.