In Remove macOS from a APFS container? there is an answer by @"David Anderson" that states that if you install 2 copies of macOS on separate partitions, then try to remove one, you need to perform this multi-step clean-up.
My question is why is it necessary to perform this clean-up? How do these commands know not to remove the recovery for High Sierra main or the second copy you installed? And if you remove these partitions, is there still a Pre-Boot and Recovery partition that remains? Please clarify.