Approximating Latent Manifolds in Neural Networks via Vanishing Ideals