Indeed.
I used to do a very similar thing with dxb. I wrote two programs: one orchestrated a dxb plot of each viewport (hidden lines removed), layer by layer (this way layering was retained), then did a dxb import on optimized dxb files. The second app was the one that optimized the dxb files in the background. While the dxb format supports polylines, AutoCAD writes everything as individual line segments. For example a circle might be represented by 72 line segments. My optimizer would find those 72 contiguous elements and convert them into a polyline. It was fun, because Autodesk's own published dxf format documentation is incorrect (tho it's real close); I had to crack the format with a hex editor.
I did a very similar thing using wmf, and incidentally, showed both programs to Autodesk representatives who came a visiting my office (they used to do this about once a year or so). About a year later they came out with an express tools flatten based on .. wmf. Coincidence? S-u-r-e. Credits? R-i-g-h-t.