I have a 2015 MBP. I have windows installed on my Macbook too, so I switched to Windows to see if the problem occurs there as well. But on windows the connection was fine, so i knew it wasn't a hardware problem - it had to be the fault of OSX. So I tried every single one of the advices i found on the internet and nothing worked for me.
Then I tried AndyAsb's idea - and it totally fixed for me too! (thanks so much Andy! 😀)
You can just plug in basically anything that gets power from usb to the other ports while your iphone is connected to one and this will fix your problem (hopefully).
It is a so simple solution that i have not thought about it, but the most infuriating thing is that apple made such a ridiculous mistake that they could probably fix in a small update.
I think the problem is that the os can not supply the right amount of power (too much/not enough(?)) via usb, and the consumption of more than one devices kinda "balances out" this inequality.