Exactly.
There's no intelligence involved in AI, it's just a beefed up version of the predictive text that's been sat on your phone for a decade. It doesn't know what it's saying, it doesn't know what images it's creating, it's not thinking at all. It's just taking an average of millions of photos that match the prompt you've asked it to create.
Content blocking content isn't actually done by the AI itself, because it can't tell what it's creating. Instead that content blocking is done by implementing checks either before or after the generation of the image.
I've had to do a fair bit of testing the limits of these LLMs for work, and in the case of Grok, it looks like it's doing both. Before it starts generating the image, it'll run a check on the input text, and if there's too many words that are on the block list, it won't generate the image at all. So stick the word "nude" in your prompt, it'll probably get blocked. "Lingerie" seems not to set it off, but "underwear" does. "Child" on it's own is fine, but in combination with other words, gets blocked, when the same prompt would be fine for an adult. Obviously it's actually more complicated than that.
This filter is fairly easy to circumvent. For example, if "lingerie" is blocked, "red sheer lacy bikini" won't be, despite the actual output looking like lingerie.
If the prompt passes the first filter, then the image gets generated, but not yet shown to the user (Grok shows an extremely blurred out version). The image is then put through another filter. I reckon what's happening here is that the image is passed through another AI model designed to describes images as text, and the same filter as before is run on that resultant text. (This is also how I reckon Mumsnets automated image moderation works).
This second check should catch anything missed by the first check, and is harder to get around using tricky wording in the initial prompt, because it's not checking that wording, but the resultant image. But it's not perfect, and is as risk of brute forcing (using the same prompt multiple times in the hope that one will get through the moderation). For instance, what is described as a girl multiple times, may get described as a young woman once, and that one will get through moderation.
At the end of the day, these models are trained up on data hoovered up from all over the internet, and that is going to involve a lot of porn, because the internet is made up of a lot of porn. So they're always going to be able to generate porn. Where Grok is different from ChatGPT etc, is that the filtering tools seem to be less strict, so more dodgy stuff is getting through them. And that edict I reckon comes straight from Musk, because it lends itself to all his "free speech" bollocks.