I took a subset of the larger textfile and included rows from the original textfile that went missing along with a couple of rows that were successfully imported and ran detectImportOptions against it.
I checked the properties of the output of detectImportOptions call and noticed that the DataLines attribute was different. In the original textfile (which included rows that were missing), the DataLines property was set to [8 Inf]. The smaller textfile had its DataLines property set to [2 Inf].
I made sure to set DataLines to [2 Inf] after calling detectImportOptions and this fixed the import issue.
opt = detectImportOptions( ...
adfmapfile, ...
'Filetype', 'text', ...
'TextType', 'char', ... % 'char' (default) or 'string'
'VariableNamesLine', 1, ...
'ExpectedNumVariables', 3, ...
'ReadVariableNames', true, ...% Treat first row as variable names
'Whitespace', ' \b\t', ...
'LineEnding', {'\n' '\r' '\r\n'}, ...
'Delimiter', {','} ...
);
opt.DataLines = [2 inf];
table = readtable(adfmapfile, opt);
MATLAB didn't import the rows out of order, it just ignored the first 8 lines for whatever reason.