Critical initialization of wide and deep neural networks through partial Jacobians: general theory and applications to LayerNorm