I saw a cycle (pedal-bike) that had a flashlight in the front. It would turn on everytime you pedaled, and turn off when you stopped. The flashlight was powered by a little motor connected to the tire. Can an electric car charge its own battery that way too?
Partially yes, but not enough to charge the car to run fully independently.
To a certain extent that's what happens. It's called regenerative braking. As power is removed from the electric motors, those motors become the opposite of a motor, they become a generator, converting kinetic energy into electrical rather than the other way around. When power is removed from the motors, the car will continue to roll along under their own momentum, and that kinetic momentum will turn back into electricity. This will result in a loss of momentum, an the car will begin to slow down. In some cases, you can choose how much regenerative braking there will be, and the more you choose, the faster that the car will slow down, just like a brake when you apply more pressure to the brake pedal.
You will never recover all of the energy of the ride through regenerative braking. At best you can recover a few percentage, so you'll still need to recharge using the plug-in port.