Most "modern" locomotives, even those with DC traction motors, generally have an alternator in place of a generator. The AC from the alternator is rectified with diodes to drive the DC traction motors. The MPAC15, dating from 1975, is an example of how long this arrangement has been in place. See the link for more info:
[
en.wikipedia.org]
This concept isn't much different from modern automobiles. Even though the electric "demand" units (starters, battery, lighting, accessories, etc) are DC, generators are long in the past, with alternators being standard for many years.