Congruences on direct products of transformation and matrix monoids