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 are plain strings without "url()" so every url() 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.