Here is a simpler option or 2)
1) add a "if dotlrn is installed" bit around the part that generates the dotlrn URL, although generally frowned upon
or
2) Add a callback to the attachments package to generate the URL to the correct file storage. Leave it unimplemented in the stock attachments package and if it is unimplemented default to the file storage mapping. In dotlrn add a callback implementation that returns the users personal folder.
In the future then, other code could override the default folder, for example, if users had a dotfolio personal file storage or other non-dotlrn folder to use.