Hamiltonian stochastic Lie systems and applications