esp_sleep_enable_gpio_wakeup can only be used for light sleep but not for deep sleep. See ESP32 sleep modes.
If you want to use deep sleep check out this example.
Please also check out this article about different sleep modes.
The sleep functions are not M5Core2 specific. They are functions of the ESP32 so it should work on all devices using ESP32. It is normal for them to be found in esp32 related libraries, but not in the M5Core2 library.
Both my sleep examples have been tested on an M5Core2 (under ESP32 Arduino framework 2.0.4 and 2.0.5), so I am stumped as to why it fails for you.
Could you please post the debug log - hopefully this will shed some light on the reason for the reboot.