Same problem here with a Surface Pro 6. Charging was OK for 6 months or so, after that problems occurred. Sometimes I have to unplug/plug it 20 times before it starts charging. Have tried about every ritual to see if I can find something reproducible. In the beginning, also the USB port didn't provide any power when the issue arose.
Last week while on vacation, I found a ritual that appeared to work every time. I first reset the charger by unplugging it for 10 seconds, both ends. Then I connected my USB smartphone to it and connected the charger to mains. The phone starts charging. Then I waited a bit and connected the magnetic connector to the Surface, which started charging too. After that, I could unplug the phone and the Surface continued to charge, every time.
But yesterday, that stopped working too. When the phone is charging and I connect the Surface, the charger stops completely, both phone and Surface don't charge anymore.
I will try the suggestions and buy an off brand charger, no way I'm paying another $100+ to MS for an unreliable replacement.
I have had a lot of issues with the Surface, also SD card drivers and other stuff, this is a substandard product in a nice packaging.