Pairing of $pi$ electronic state structures with functional or metallic atoms makes them possible to engineer physical and chemical properties. Herein, we predict the reorientation of magnetization of Co on hexagonal BN (h-BN) and graphene multilayers. The driving mechanism is the formation of the tetrahedral bonding between sp$^3$ and d orbitals at the interface. More specifically, the intrinsic $pi$-bonding of h-BN and graphene is transformed to sp$^3$ as a result of strong hybridization with metallic $d_{z^2}$ orbital. The different features of these two tetrahedral bondings, sp$^2$ and sp$^3$, are well manifested in charge density and density of states in the vicinity of the interface, along with associated band structure near the $bar{K}$ valley. Our findings provide a novel approach to tailoring magnetism by means of degree of the interlayer hybrid bonds in 2D layered materials.