Scalable Marginalization of Correlated Latent Variables with Applications to Learning Particle Interaction Kernels