@Voske_123: My mod creates a locomotive for each existing locomotive in the data-updates.lua. It adds a single localized parameter - maybe there is a loop?
Each created motorcar-variant is logged, maybe that could help.
I already ignore locomotives created by hidden items. But I could ignore specific locomotives, or you could ignore my motorcar-variants (name starts with "railway-motor-car-").
Let me know if you found a solution.