Those "extra rights" would need to be spelled out in the terms of service, and last I checked, they were basically just making sure GitHub had the legal right to host your code on the GitHub service. It did not include any provision to create and distribute derivative works outside the license included with the software being hosted.
Chapter D4 gives microsoft the right to: parse it into a search index or otherwise analyze it on our servers
I don't know what a real court says, but I can imagine a lawyer saying training an AI is done by analyzing your code.
Chapter D5 gives almost anybody right to do a lot with your code, including creating derived works, as long as it happens on github. If the AI training happens on their servers, I think you agreed to them training an AI.
Not saying they are doing it right now based on that document. But I do assume a lawyer has enough material to make the waters really muddy, and a trial being decide by basically a dice roll.