Source code rewrite transformations

Maybe? You can use usingnamespace to add declarations to a struct:

function StructBuild(T: type, U: type) type {
    return struct {
        a: T,
        b: usize,

        const which_namespace = comptime if (T == SomeType)
            ContainerA(@This(), T)
        else
            ContainerB(@This(), U);

        pub usingnamespace which_namespace;
    };
}

That kind of thing? ContainerA and ContainerB would also be functions which take types as arguments and return struct types used as namepaces.

The return values don’t need to have fields:

const NoField = struct {
    pub fn something() usize {
        return 5;
    }

    pub fn somethingElse() bool {
        return true;
    }
};

test "No field needed" {
    try expectEqual(5, NoField.something());
    try expect(NoField.somethingElse());
}

The functions you define this way can use arguments to whatever function is returning the type, and you can even pass in the type you’re defining with @This(),

If I follow what you mean by reification here, this might get the job done.