Use a license that doesn't allow it then.

Not everything needs to be mit or gnu.

LLMs don't care about licenses. And even if they did, the people who use them to generate code don't care about licenses.

Thieves don't care about locks, so doors are pointless.

Thieves very much do care about doors and locks, because they are a physical barrier that must be bypassed, and doing so is illegal.

Software licenses aren't, AI companies can just take your GPL code and spit it back out into non-GPL codebases and there's no way for you to even find out it happened, much less do anything about it, and the law won't help you either.