I would think one of dynamic DNS client utilities might do this... Check through the list here and see if any allow running an external command on detection ...
In an upcoming blog I expect to write about configuring a home router, which requires logging on to it. This, in turn, requires knowing the IP address of the router. Non-techies typically don’t know ...