In intermetallic compounds with zero-orbital momentum (L=0) the magnetic anisotropy and the electronic band structure are interconnected. Here, we investigate this connection on divalent Eu and trivalent Gd intermetallic compounds. We find by X-ray magnetic circular dichroism an out-of-plane easy magetization axis in 2D atom-thick EuAu2. Angle-resolved photoemission and density-functional theory prove that this is due to strong f−d band hybridization and Eu2+ valence. In contrast, the easy in-plane magnetization of the structurally-equivalent GdAu2 is ruled by spin-orbit-split d-bands, notably Weyl nodal lines, occupied in the Gd3+ state. Regardless of the L value, we predict a similar itinerant electron contribution to the anisotropy of analogous compounds.