Fix RDG generating invalid code for types from other source generators (#65453)