Issue is caused by function that is called on templatingFunctions object.
Function that generates the prefix must take into account:
- context path
- site name, if no matching domain is found
- locale from the prefix must be ommited
Possible option is to extract part of code that generates prefix into a protected method and override it in MultiSite module.