Hacking a bike motor sounds like a dangerous, probably illegal, idea.
Too many ebikes and electric scooters have already exploded or catched fire.
People hacking their vehicles is ruining other users experience, since it is making authorities forbid carrying them in public transport or even using them in public places or ways.
Simply don't do that.