Yes, but diesel-electric locomotives have a brake mode where the "regenerative" current is shunted through big air-cooled resistors and exhausted as heat. Often used on downgrades to control speed without burning up the brake shoes. Recovering this into battery charge would be an easy win, though you might still need the resistors after the batteries are fully charged or if they can't absorb the charge fast enough.