Algebraic independence of G-functions and congruences "à la Lucas"