I looked through the .dxf reference manual, and here's what I see.
$INSUNITS is used when inserting a block or other object into a drawing (in AutoCAD). It shouldn't be used to determine the drawings units, as that's not what it's for.
I just spent about 30 minutes researching this, and I don't see anything in the .dxf file that specifically states the units used.
I just realized that there really is no unit setting in AutoCAD. You can only set the units for inserted objects ($INSUNITS). I had previously mistakenly believed that this was a unit setting, but never read the description closely enough to actually understand what it is.
There is a setting to determine imperial or metric, but it's not unit specific.
0 = imperial
1 = metric
AutoCAD let's you specify the type of units, but not the actual units.
I've used a .dxf to machine code program in the past that would automatically assume mm's if entities wer larger than a specified size. But this was for large woodworking machines, where you could say that any size over 200 was automatically mm's.
Imo, when a .dxf is imported, no scaling should ever be applied. Things would be much simpler. Unfortunately, scaling is pretty common it seems, and it usually causes problems.
Does this help?