The PCI system is designed for handling this.
in PCI system, the all add-in cards will have pins with different lengths. there are PRSNT pins which are of less length compared to other pins. Because of this during connecting, these pins will mate last after that only Host detects card and enables power, so, they are as per intended operation. During un-plugging, these pins are first to un-mate. So, immediately Host will remove the power.
in addition to it, Hosts will have lot of intelligence in power.