What doesn’t seem to make sense is requiring Amazon to do the actual safety testing. That would be akin to requiring baby stores to run safety tests on strollers, or requiring car dealerships to perform crash tests.
Let's assume that you have a physical store and you import and sell a toy and trust the manufacturer-provided documentation that claims that the toy is safe. The customer trusts you and relies on you to ensure that the toy is safe, the customer doesn't need to trust the manufacturer. If it turns out that the offshore manufacturer lied and faked the documentation, that's not the customer's fault or problem - you're fully liable and need to compensate the customer for selling a shoddy product that's apparently not fit for sale. Generally you have the right to recover that compensation from the manufacturer but if you can't do that (e.g. the manufacturer has since disappeared, or is insolvent) then that's not the customers problem, they bought the thing from you and it's your responsibility to uphold the warranties (at least in EU law) - so if you sell products from shoddy manufacturers then you assume full responsibility of them, which generally means that importers/distributors (or large retailers - a small store would delegate that task&risk to the wholesale importer/distributor, a major chain would do it themselves) audit their suppliers to ensure that they're not lying, faking safety documentation, etc.
The baby store doesn't need to run safety tests on strollers, but it does need to verify that the safety tests have been done and ensure that the strollers are actually safe. The store can (and usually will) rely on others to ensure the safety and testing, but if they choose to rely on unreliable partners, that's the fault of that store.
That's kind of the problem, isn't it? They've "agreed" to do it, as if not doing that was also an option but Amazon decided generously (and not to set precedent) to comply with the law.
Corporations are not sex offenders, they are very rational. If you fine them, their delinquency stops. If you don't, it won't.
If the retailer saving money because the factory they sourced their product from is not testing adequately then obviously the retailer is shouldering that risk and becomes the responsible party. They don't necessarily need to do the testing in house, they could outsource it, but ultimately the cost of testing should be borne somewhere in the supply chain, before it reaches the consumer.
And honestly, this should be better for the retailer than sending them into the outside world untested and then having to do some big recall operation when, in this example, either a parent spots the flaw or the baby stroller collapses on their child.