That seems to work, but may be overengineered.
I think the behavior of @import depends on the file doing the including. So check the extension of the file being loaded not the one being imported. Then there will be no need for a callback?
LESS imports[1] are plain strings without "url()" so every url()[2] substitution should be relative to DOKU_BASE (or an absolute URI). Moreover, LESS may generate its own url() strings, so that substitution needs to be done again after lessc. Actually, I'm not sure what to do about this because we don't know the source path from which imported LESS files. i.e. style.ini includes css/screen.less that imports less/icons.less that has a url(../../images/icon.png). The URL should be resolved relative to css/less but the change of directories is buried in the LESS compiler.
[1]
http://lesscss.org/#-importing
[2]
http://www.w3.org/TR/2011/REC-CSS2-20110607/cascade.html#at-import