I mean, you could do that, but that's not really where the problem lies
Usually the nefarious party doesn't outright steal your code. It's more about stealing your idea and rushing it to market before you can yourself. AI driven development can speed this process, and it lowers the barrier to entry because you don't have to have a deep understanding of code to hack something together.
Before AI, people would still do this. The pipeline would be that you'd contract out overseas where skilled labour is cheap. A team of people can typically work faster than a single developer, so this really hurt indies. However, it was also really rare because there was considerable expense and it still took a fairly long time to develop.
So in these cases, it's not actually your work that's being stolen, but the idea. Now, that feels bad, but I also don't think you can copyright an idea (many courts agree). But it feels scummy, especially when it's a major player doing it to the little guy.
As far as actually stealing the code though, it does happen and you don't need AI to do it. I've spoken with a couple of fellow devs in game jams where this happened to them. We were participating in the Ludum Dare game jam, and they have a requirement that your source code is available so that others can learn from you. However, some developers don't have an understanding of exactly what kind of licensing that entails - indeed many of them didn't even include a license.
In one example, a developer had included all of their assets with their source code - art, music, the works. Some company took their game and ported it to the Google Play store where it was briefly a hit. The developer didn't benefit from this at all, never saw a penny, and had no legal recourse because the terms of their license did technically allow it.