Apple invented the modern slab-of-glass smartphone industry, and always shipped a high-quality charger and headphones with the iPhone, something which started with its ancestor the iPod.
As a result, everyone else had to sell... some kind of earbuds and charger. These didn't have to be good, but they did have to be in the box.
Apple had the margin to make these quality: you can get better earphones but not better chargers. Their competitors had to put the same type of object in the box, cutting into already slim margins and often shipping something which sounds bad, and that makes the iPhone look better.
But as the market leader, they had the ability to say "The best phone in the world (reality distortion field!) no longer comes with earbuds or a charger. We figure you have enough chargers, and probably like the headset you have, and if you want new ones, we sell them".
So everyone else can just drop the shipping of mandatory e-waste, just to keep up with the iPhone. It was a bad Nash equilibrium, and only the market leader was in a position to break it.
Feel free to discuss the missing headphone jack and the multibillion dollar AirPods platform in the replies!