This is already the behaviour when python is deployed, likely due to a bug with it.
I had to add this because I had an incident with carla where the library has a relative ../../share/carla/resources symlink and it was broken as result, because it would point to shared/share instead of share.
It is likely there are other libraries that rely on a relative ../share dir so it is better to just make lib the default directory and shared/lib the symlink instead.