A method for modelling the prompt production of molecular states using the hadronic rescattering framework of the general-purpose Pythia event generator is introduced. Production cross sections of possible exotic hadronic molecules via hadronic rescattering at the LHC are calculated for the $chi_{c1}(3872)$ resonance, a possible tetraquark state, as well as three possible pentaquark states, $P_c^+(4312)$, $P_c^+(4440)$, and $P_c^+(4457)$. For the $P_c^+$ states, the expected cross section from $Lambda_b$ decays is compared to the hadronic-rescattering production. The $chi_{c1}(3872)$ cross section is compared to the fiducial $chi_{c1}(3872)$ cross-section measurement by LHCb and found to contribute at a level of O(1%). Finally, the expected yields of $P_c^+$ production from hadronic rescattering during Run 3 of LHCb are estimated. The prompt background is found to be significantly larger than the prompt $P_c^+$ signal from hadronic rescattering.