Thing is, it's not ten million - it's several orders of magnitude fewer, particularly if we're starting with just a selected list of generators.
Also we know the locations of the generators, so we can calculate the phase shift and control them accordingly. At thousand kilometres it's around 60 degrees anyway, so not catastrophically huge.
But also, it isn't just generators, it is also the indeterminate loads. If you have nearby loads switching on and off that are similar sized to your local inverters, that is a complicated controls modelling problem.
I'm pretty sure in grid terms, 60 degrees out of sync is catastrophic. I'm pretty sure you'll be disconnected by protection circuits before it gets that far out.
Also we know the locations of the generators, so we can calculate the phase shift and control them accordingly. At thousand kilometres it's around 60 degrees anyway, so not catastrophically huge.