It's only illegal if the law is actually enforced. Thankfully, due to MeToo, revenge porn gets way more of a response from the law than it did.
That is not currently the case in any meaningful way with image generators being used to make CSAM, which is why it's important that the companies themselves be held liable. Grok still lets you do this if you buy a sub. Copilot lets you do this and Microsoft knows it, per recent leaks from their prompt reviewers. Meta runs ads for CSAM on Facebook.
In this case, multiple tech companies are knowingly enabling these crimes without a peep from the law to stop them. (At least in the US.)