Stellar evolution with rotation and magnetic fields - IV. The solar rotation profile