While type theory certainly has traditionally been used for different purposes than model theory, as noted in this Philosophy SE post, I wonder to what extent type theory could model model theory itself.
My motivation for this question is based on an observation that we can view the typing relation in type theory as analagous to the "is a model of" relation in model theory. For example, one might regard the Sigma type $Magma(A) :\equiv\Sigma_{a:A} A \rightarrow A \rightarrow A$ as the theory of magmas over a type A, and components of said type models of the theory.
Now certainly, model theory has more structure to it than a simple "x is a model of y" relation between theories and models of those theories, but I think the idea of interpreting types and terms as a theory/model relation begs the question: Can we develop a richer language in type theory to deal with this types as theories, terms as models interpretation in order to interpret traditional (i.e. ZFC-based) model theory within a type theoretic framework? And, if full interpretation with classical model theory is not possible, is there still some meaningful type-based model theory that we could develop?