I would think that this is something that you should "detect" but not "attempt to fix," because now your "fix" is buried where the sysadmin's won't know where to find it. Loader library-paths should be set at only a few well-established places, e.g. profile scripts. An ill-thought-out "workaround," even though it might "make my program work now," might be a big future headache and mask the existence of a root-problem without solving it. Discuss the matter next with your sysadmins and/or management.
I disagree. LD_LIBRARY_PATH should not have to be set at all, but if it must be set, then just set it in as localized a place as possible to run what you need to run.