Second-Order Analysis of Polyhedral Systems in Finite and Infinite Dimensions with Applications to Robust Stability of Variation