The production cross section of 30.92 GeV/$c$ protons on carbon is measured by the NA61/SHINE spectrometer at the CERN SPS by means of beam attenuation in a copy (replica) of the 90-cm-long target of the T2K neutrino oscillation experiment. The employed method for direct production cross-section estimation minimizes model corrections for elastic and quasi-elastic interactions. The obtained production cross section is $sigma_mathrm{prod}~=~227.6~pm~0.8mathrm{(stat)}~_{-~3.2}^{+~1.9}mathrm{(sys)}~{-~0.8}mathrm{(mod)}$ mb. It is in agreement with previous NA61/SHINE results obtained with a thin carbon target, while providing improved precision with a total fractional uncertainty of less than 2$%$. This direct measurement is performed to reduce the uncertainty on the T2K neutrino flux prediction associated with the re-weighting of the interaction rate of neutrino-yielding hadrons.