Suppressed phase separation of mixed-halide perovskites confined in endotaxial matrices