Focused ion beams perfectly suit for patterning two-dimensional (2D) materials, but the optimization of irradiation parameters requires full microscopic understanding of defect production mechanisms. In contrast to freestanding 2D systems, the details of damage creation in supported 2D materials are not fully understood, whereas the majority of experiments have been carried out for 2D targets deposited on substrates. Here, we suggest a universal and computationally efficient scheme to model the irradiation of supported 2D materials, which combines analytical potential molecular dynamics with Monte Carlo simulations and makes it possible to independently assess the contributions to the damage from backscattered ions and atoms sputtered from the substrate. Using the scheme, we study the defect production in graphene and MoS2 sheets, which are the two most important and wide-spread 2D materials, deposited on a SiO2 substrate. For helium and neon ions with a wide range of initial ion energies including those used in a commercial helium ion microscope (HIM), we demonstrate that depending on the ion energy and mass, the defect production in 2D systems can be dominated by backscattered ions and sputtered substrate atoms rather than by the direct ion impacts and that the amount of damage in 2D materials heavily depends on whether a substrate is present or not. We also study the factors which limit the spatial resolution of the patterning process. Our results, which agree well with the available experimental data, provide not only insights into defect production but also quantitative information, which can be used for the minimization of damage during imaging in HIM or optimization of the patterning process.