Answers checklist.
General issue report
This issue is present in ESP-IDF 5.5.1, though I suspect that the issue is also present in previous versions.
Inside of sdmmc_host_deinit(), ESP-IDF loops through all possible SD card slots in the system. It then calls sdmmc_host_deinit_slot_internal(...) on all of those slots, without checking whether the slots have previously been initialized. If a slot has never been initialized, all of the GPIO structures for that slot appear to be zero-filled. As a result, reset_pin_if_valid(0) is repeatedly called for the uninitialized slot. This resets pin #0, causing issues if that pin is used elsewhere for other functions.