Fixes type rewriting to only children of <types>

In the previous commit the type rewriting code was incorrect for the
types. In specific the <type> node is also present in profiles, where it
should not be rewritten.