GALACTICNUCLEUS: A high angular resolution $JHK_s$ imaging survey of the Galactic Centre. I. Methodology, performance, and near-infrared extinction towards the Galactic Centre