My iPhone Xs Max just did this as well when I tested it. And as you can see the comments under the video, it seems to affect all devices on iOS 12 and not just the new models.
I plugged it in, nothing. I even woke up the screen, nothing, I had to unlock it and get to the desktop for it to start to charge which was weird.
Now after it did it once, I couldn't duplicate it again till the phone sat on my desk for a few minutes. (I assume whatever it is needs to go to sleep).
https://discussions.apple.com/thread/8551504