Hausdorff dimension, pro-$p$ groups, and Kac-Moody algebras