My best advice would be: Don’t. There’s no need to go hacking the core code in MODx. You’re much better off just hard-coding your base root in your config file or writing a plugin to write these URLs correctly (or rewrite them when they’re wrong).
So the first thing I would do is try to fix your subsite setup so that it generates the URLs properly. If that’s not working out easily for whatever reason, then I’d just verify that the problem is that your base URL isn’t being set properly in every context and if so hard-code it in your config.inc.php file and see if that fixes it. And I guess the last kludge I’d attempt is just using a plugin to replace any occurrence of "home/home/" with "home/" when the document is rendered (look at the plugin that removes the MODX_MEDIA_PATH code for an example of how to do that).
There’s pretty much never a reason to mess with the core code in MODx, and I suspect that you’d regret it if you did.