@siam I believe what it means is that the current layer number is read from the file, but it does not say the 'total number of layers' is read from the file.
If I haven't read from the wrong branch of code, here is what's in RFF for reading number of layers
unsigned int GCodeFileInfo::GetNumLayers() const noexcept
{
if (layerHeight <= 0.0) { return 0; }
const float nl = (firstLayerHeight > 0.0)
? (objectHeight - firstLayerHeight)/layerHeight + 1
: objectHeight/layerHeight;
return (unsigned int)lrintf(max<float>(nl, 0.0));
}