How do make a .deb package that reconfigures itself when dependencies are upgraded

I need to build a deb for my application that adjusts some links in my system when installed (I do that in my postinst script). However, when a dependency is upgraded, I might also need to adjust my links. So, ideally I want my prerm (to remove all the links I created) und my postinst (to reestablish them again) to be called whenever my dependencies are updated. Is there a way to force this behavior for my package? If not, is there any other way I can achieve my goal, i.e., some magic script that is called on dependency changes?