On a different note, I was facing the same issue with my Pixel 2 (5") last month post Pie upgrade. The issues were exactly same, intermittent charging to no charging at all or charging only when phone is switched off. Also, headphone adaptor stopped working.
I lodged a complaint with Google...