It turns out that neither the dock nor the AC adapter were faulty, since they both worked fine with another Switch. My original Switch had a faulty USB-C port, which wouldn't connect properly to the cable unless I would wiggle the cable around, hoping for the connection to be made.
I experienced a similar problem and followed these steps. Everything works now, but I don’t know what caused the issue, or whether it will reappear. https://en-americas-support.nintendo.com/app/answers/detail/...-cannot-be-charged