Fancy String Replace let S, a and b each represent a string

Goal: Write a standard string replace function where the you replace all occurrences of a in a string S with b so long as a is not already part of an instance of b

for example, if we have the string S = My oh my that there is a big ol' that

and we wanted to do a fancy replace with a = that and b = that there we would replace every instance of that with that there as long as the instance of that isn't already an instance of that there

So in this case the output would be: My oh my that there is a big ol' that there

The first that is not replaced because it is already part of an instance of that there

Notes


All 3 inputs must be strings containing only printable ascii characters
Input may be given as 3 separate strings or a list of 3 strings
Input will be in the order S, a, b unless otherwise specified in the answer
In order for a to be considered a part of b, all of the instance of a must be part of an instance b


Some Corner Cases Explained

Input:  ["1222", "22", "122"]
Output: "12122"


In the case above example the latter 22 is replaced. Even though part of it is part of an instance of b, the entirety of it is NOT a part of the instance of b. Since the entire instance of a is not part of an instance of b it is replaced. 

Input:  ["123 ", "23", "12"]
Output: "112 "


This test case illustrates the same case as above but perhaps in a slightly more clear way. Again the 2 in the middle is both part of an instance of a as well as part of an instance of b, however since all of a is not part of the instance of b it is still replaced.

Input: ["Empty", "", "p"]
Output: "pEpmptpyp"


In the above test case both the empty string before and after the p are not replaced as the can wholly be considered part of the instance of p.

Other Test Cases

Input:  ["aabbaa", "aa", "aabb"]
Output: "aabbaabb"

Input:  ["Hello World!", "o", " no"]
Output: "Hell no W norld!"

Input: ["Wow, oh wow, seriously WOW that's... wow", "wow", "WOW,"]
Output: "Wow, oh WOW,, seriously WOW that's... WOW,"

Input: ["Empty", "", "b"]
Output: "bEbmbpbtbyb"

Input: ["Empty", "b", "br"]
Output: "Empty"

Input: ["Empty", "pty", "Empty"]
Output: "Empty"

Input:  ["aabbaaa", "aa", "PP"]
Output: "PPbbPPa"

Input:  ["121212","1","121"]
Output: "121212"




This is a question for code-golf so the shortest answer in bytes wins.
Perl 6, 76 bytes



{$^b;$^a;&amp;{S:g/$a&lt;?{$!=$/;all m:ex/$b/&gt;&gt;.&amp;{$!.to&gt;.to||.from&gt;$!.from}}&gt;/$b/}}


Try it online!

Anonymous code block that takes input curried, like f(a,b)(s). 

I'm pretty sure this matches up with the intent of the question. Basically, it only makes the substitution if the position of a is not within any of the overlapping matches of b.