I think if Microsoft was figuratively and literally rate limited from accessing such a huge swath of open source code, they might not have been the ones to build something like Copilot and we may have been better off for it. A different, more ethical team might have made something better. Maybe it would even be an open source project.
That's my point-- how? Presumably you're just going to host your FOSS somewhere else that Microsoft can still get it.
The problem isn't that Microsoft can access you code. It's the section D.4 on Github's terms of service [1]. If you are hosting your code on Github, you are essentially giving Microsoft the legal rights to do certain things with your code. That section is broad enough to allow Microsoft to train copilot with your code. It gives them the freedom to disregard the license. On the other hand, it would be a clear violation of the license if they read your code off another hosts and reproduced it verbatim. I don't know whether any legal challenges would stand in a court, but at least you are not giving away the right to do so.
[1] https://docs.github.com/en/site-policy/github-terms/github-t...
Also, nothing prevents Microsoft from completely ignoring licenses and terms of use elsewhere. This product isn't open source: they can keep the list of projects they crawl to themselves, and I don't see any way to stop it.
Or, the platform could make it part of their terms of use that licenses must be respected even for machine learning. It could be enough of a barrier to dissuade them.
Would something like that stop Microsoft? Maybe, corporations tend to look for low hanging fruit for stuff like this.
Small changes in a situation like this can make a big difference in outcome.