The USB-C standard and particularly the USB PD (power delivery) is so complex it almost feels comical.
The PD standard document (freely available on usb.org) is over 800 pages long and features a lengthy part about the role of the cable alone which is mostly hidden from the user. Here's a short video about this issue: https://www.youtube.com/watch?v=6bZ0y9G-4Pc