That’s exactly what the WEEE directive is in the UK/EU. I ran a company that manufactured and sold an electrical product and we had to pay an amount based on weight sold per quarter from memory. I have no idea if it’s actually used to help with disposal of end of life electrical waste but we paid a decent amount of 8 years of sales.
In Madrid at least we have “Puntos Limpios”, where consumers can properly dispose of many different kinds of waste, including electrical appliances, for free.
In addition, once a month there is a “punto limpio móvil” on each neighbourhood: a small truck from the city parks on a reserved spot for 2h to get the special waste from the neighbours, also for free.
That sounds fantastic. I'm in London and the lack of easy waste disposal without a car is the only thing that makes me wish I was driving... It's such an own goal that you create an incentive to keep having a car if you want to recycle.