For our purposes (i. e. reconstructing the migration of the ancestors of the South Slavs) we are interested in languages considered as linguistic constructs and not as political entities. The standard language of Croatia is based on Štokavian, a dialect which is spoken by the majority of Serbs. Torlakian is closer to Štokavian than are either Kajkavian or Čakavian, and might as well be a kind of para-Štokavian. ISO codes are not only politically biased but completely irrelevant in this.
Many people in the Balkans do not understand this,before national borders and the creation of the standard languages today,there was only dialects then appeared "linguists" from each newly created country to show which dialect is what,it is hilarious even to an amateur.For example i speak the Torlak dialect.Serbian linguist will classify it as Serbian or "transitional",Bulgarians as Bulgarian or transitional and Macedonians as Macedonian dialect in their part of the country,and before the standardisation of modern languages there was little differences,as closer the regions was closer dialect they spoke.
In reality political biases made the languages or dialects much far away from eachother as Bulgarians adopted some dialect of eastern Bulgaria as standard,Serbs some Shtokavian or so called Serbo-Croatian was based on Sthokavian and in reality you have Torlak dialect,Kosovo-Resava dialect etc not in use in standard Serbian,Kajkavian or Cakavian in Croatian standard.
Some dialects are in danger because of this as for example Torlakian is,Serbs will claim is broken Serbian likewise neighbors around,and in reality is more archaic and more mutually inteligiable to each South Slavic country as it is "transitional".
Standardisation of languages happened when each country was created and appeared "linguists" with political affiliation to claim which dialect is what,the closer the region was closer dialect they spoke it is very simple,national borders today make boundaries between regions and dialects that are not natural, and many dialects will go extinct.