Theoretical insights into the RR Lyrae K-band period–luminosity relation