Without going into too much of a deep dive, I had a bit of a hunt across that universal source of truth known as the internet.
A crude consensus says that reasonably maintained chain+derailleur-based drive will be about 90-98% efficient.
In contrast, a good ebike motor seems to be about 75% efficient, while you can get about 95% from a decent dynamo (this number is higher than I expected but I found it quoted in two separate sources). I’d be surprised if the power generated at the dynamo was transmitted directly to the motor. At the very least there’d be some small power loss from the associated electronics, but I’d also expect some significant drops for current/voltage mangling and regulation, so let’s allow a couple more % for that.
All in all that gives an efficiency on or below 70%, and I think I’m being generous. Thats an awful lot of extra effort doing not much apart from saving you some occasional chain cleaning.