Theory of Turing machine which outputs Turing machine? I understand the notion of the universal Turing machine ($U$), which receives a pair of Turing machine ($M$) and an input to $M$ ($x$). If $M$, which obtains $x$, outputs $y$, $U$, which obtains $(M, x)$, outputs $y$ as follows:

$M: x \mapsto y \\
U: (M, x) \mapsto y$

My question is whether there is a theory of another type of Turing machine where the output (not input) of Turing machine is another Turing machine like:

$U': x' \mapsto M$

I guess a program which generates another program can be regarded as this kind of Turing machine $U'$. If so, automatic code generator and machine learning algorithm might be regarded as this type of Turing machine.

(Maybe, brains of human programmers can be modeled using a theory of such Turing machines because a source code seems a form of Turing machine.)
It depends on what your are referring as "theory" (which basically means everything or anything).

Something which is closely related to what you are referring can be the 
field of Program transformations, which tries to study systematically 
programs that modifies other programs. The original interest of this field is the transformers that are semantically invariants (with a bit of hand waving:  you want to study transformers $T$ such that for any program (or a TM) $p$, $T(p)$ does the same thing as $p$). Derives from these original considerations the subfield of program synthesis (here, given some input datas, you want to automatically generate a program that satisfies some conditions encoded by you input).

A good introduction can be the thesis of M. Ward "Proving Program Refinements and Transformations" with an emphasis on the proof of program side.