It can't be AI all the way down. Even if an AI aware enough to completely rewrite itself were possible, it will have bugs. That's because, if we go all the way down, there's always the human factor (whoever wrote the AI that can rewrite itself in the first place), which will cause errors.
So, no, AI won't replace programmers, it will just force all programmers to be AI programmers. And even that is doubtful or still quite a few years down the line.