If you use a relay to bypass the controller, and a power diode on that bypass circuit to prevent the battery from driving the motor, then you have a passive means to charge the battery-- if and only if the motor is being turned faster than it will turn when connected directly to the battery with no load. This threshold speed is a function of the battery's voltage, and thus it will change as the battery goes deeper into its discharge curve.
Above that speed, resistance in the motor will build rapidly with small increases in speed, effectively limiting the bike's speed to just a little more than the no load speed and diverting portion of any excess power to the battery.
This is the same principle I used when I made a stationary generator bike-- pedal up the generator, the relay switches on at about 7V, the power diode allows current to enter the battery when the voltage surpasses the sum of the actual battery voltage and the forward voltage of the power diode. At that point, the resistance at the pedals really piles on hard.
If you use a boost converter on the relay-controlled circuit, then you can get the battery to charge at a lower speed, possibly even low enough to be useful as a brake. But in that case, charge current (and braking power) would be limited to the capacity of the boost converter. And there would be a further efficiency toll on the system.