The discovery in 2001 of superconductivity in some heavy fermion compounds of the RMIn$_5$ (R=4f or 5f elements, M=Co, Rh, Ir) family, has triggered enormous amount of research pointing to understand the physical origin of superconductivity and its relation with magnetism. Although many properties have been clarified, there are still crutial questions that remain unanswered. One of these questions is the particular role of the transition metal in determining the value of critical superconducting temperature (Tc). In this work, we analyse an interesting regularity that is experimentally observed in this family of compounds, where the lowest Neel temperatures are obtained in the Co-based materials. We focus our analysis on the GdMIn$_5$ compounds and perform density-functional-theory based total-energy calculations to obtain the parameters for the exchange coupling interactions between the magnetic moments located at the Gd$^{3+}$ ions. Our calculations indicate that the ground state of the three compounds is a $C$-type antiferromagnet determined by the competition between the first- and second-neighbor exchange couplings inside GdIn$_3$ planes and stabilized by the couplings across MIn$_2$ planes. We then solve a model with these magnetic interactions using a mean-field approximation and Quantum Monte Carlo simulations. The results obtained for the calculated Neel and Curie-Weiss temperatures, the specific heat and the magnetic susceptibility are in very good agreement with the existent experimental data. Remarkably, we show that the first neighbor interplane exchange coupling in the Co-based material is much smaller than in the Rh and Ir analogues due to a more two dimensional behaviour in the former. This result explains the observed lower Neel temperature in Co-115 systems and may shed light on the fact that the Co-based 115 superconductors present the highest Tc.