I think the answer is most likely no, not in the most notable examples of AI programs (such as Machine Learning). There is a set of AI techniques which involve automatic programming, but in that scenario, we have a computer program which automatically codes another program (we can call it "target program"). But the target program is not the program which perfoms the coding; so technically speaking, no, it does not write its own code. This is an important difference; the programmer still has the task to write the code-generator.
If you are interested in automated coding, though, the most notable example is Genetic Programming, a technique which uses an evolutionary algorithm to breed computer programs. As you can see, we have an AI which produces as a result a computer program (which may be or not an AI program); it is not interacting with its own code.