I think the "I just write for myself" is often just a weird flex. Or maybe it's just something writers say so that they don't feel bad if they don't end up finding readers. Then they can just say, “Well, I just wrote for myself anyway."
That said, I do write for myself too. But that's in my journal and in cryptic bullet point format. It's nothing anyone besides me could understand.
If I'm writing proper prose, it's for someone else to read. However, I write it in a style that my past self would have enjoyed. So only in that sense am I writing for myself :)