What spins the wheel with the generator for charging the battery? The battery driving the motor? You can't Doo Dat!
The battery makes the ebike go. The generator makes the ebike stop. Then instead of charging the battery you are heating the motor and the generator, and are killing the battery.
Like the guy who tried a computer fan as a generator on his pedal bicycle to charge his phone. Not enough power. So he tried a huge fan that worked fine when the bicycle was stopped and the wind was blowing. But when the wind stopped it was a lot of work to pedal the bicycle and drive the fan generator, like pulling an opened umbrella behind him..