First, the hypotheses of the theorem I proved require that $Y$ be compact and oriented, in addition to requiring that $g$ be real-analytic.
Second, the method I used (the Cartan-Kähler Theorem) extends, essentially without modification, to higher dimensions as long as $Y$ is compact and parallelizable and $g$ is real-analytic.
Real-analyticity is certainly necessary, since a minimal submanifold of a real-analytic Riemannian manifold (such as a Calabi-Yau manifold in any dimension) is necessarily real-analytic itself.
By contrast, not all special Lagrangian submanifolds of a Calabi-Yau are parallelizable. Thus, parallelizability is not necessary in general, but I don't know how to remove that hypothesis in the existence proof. For example, I do not know whether every real-analytic metric on $S^4$ is obtainable by embedding it as a special Lagrangian in some $4$-dimensional Calabi-Yau.