You could always wrap foo inside a new function which will call the old foo, and then call bar. Then you change the name of this new function to foo. As far as the outside world is concerned foo should work as expected, but secretly your replaced implementation will also call bar. Win!
fooinside a new function which will call the oldfoo, and then callbar. Then you change the name of this new function tofoo. As far as the outside world is concernedfooshould work as expected, but secretly your replaced implementation will also callbar. Win!