That’s actually already how the diesel-electric drive-train of a railway locomotive works - and coupled with a battery it would give the best of all combinations. Only downside is permanently lugging around the generator. This is what they’re looking at for some military vehicles.