I'm looking for a reference explaining under what conditions the internal Yoneda lemma holds; in particular, I am wondering if it is known what properties of the ($2$-)category of categories are responsible for the following.


Take a (small) category $\mathcal C$, i.e. a category internal to the category of sets. Promote it to a category internal to the category of (small) categories via the arrow category $\mathcal C^\to$. Then (split) fibrations over $\mathcal C$ are a reflective subcategory of the category of internal presheaves on $\mathcal C$, and furthermore are precisely the internal presheaves for which the Yoneda lemma holds.



Yoneda Lemma for internal presheaves
The Yoneda lemma holds in any finitely complete $2$-category $\mathscr{K}$, such as the $2$-category $\text{Cat}(\mathscr{C})$ of internal categories in a finitely complete category $\mathscr{C}$. 


The statement is that for any object $B$ of $\mathscr{K}$, any morphism $b \colon 1 \to B$, and any discrete fibration [i.e. internal presheaf in the case $\mathscr{K} = \text{Cat}(\mathscr{C}$)] $p \colon E \to B$, there is a bijection between hom-sets in the slice category $\mathscr{K}/B$
$$ \text{Hom}(d\colon B/b \to B,p\colon E\to B )\cong \text{Hom}(b \colon 1 \to B, p\colon E \to B)$$
induced by the canonical morphism from $(b \colon 1 \to B)$ to the projection $(d\colon B/b \to B)$.


This is due to Ross Street: a more general version of the internal Yoneda lemma (for general morphisms $b \colon X \to B$ and two-sided discrete fibrations) was proved in the paper



> 
> Street, Ross. Fibrations and Yoneda's lemma in a $2$-category. *Category Seminar (Proc. Sem., Sydney, 1972/1973)*, pp. 104--133. Lecture Notes in Math., Vol. 420, Springer, Berlin, 1974.
> 
> 
> 


For further generalizations see Street's paper [*Categories in categories, and size matters*](https://journals.mq.edu.au/index.php/higher_structures/article/view/51), which moreover contains a proof of the following fact. For any internal category $C$ in a finitely complete category $\mathscr{C}$, there is a isomorphism between the category of split fibrations over $C$ in the $2$-category $\mathscr{K} = \text{Cat}(\mathscr{C})$, and the category of discrete fibrations (i.e. internal presheaves) over $\text{sq}C$ in the $2$-category $\text{Cat}(\mathscr{K}) = \text{Dbl}(\mathscr{C})$. Here $\text{sq}C$ denotes the internal category in $\mathscr{K}$ whose "object of objects" is $C$ and whose "object of morphisms" is $C^\mathbf{2}$. I believe this addresses your last question.


