You have to change the order of your rules for this. Since a is also part of of an it will always satisfy the first condition. In general, put the conditions with the most number of characters in front. The single is more like a fallback.
For banana, you again have multiple rules that apply so it’s a matter of setting a priority depending on what your preference is, like moving ba before an in the Rule Engine.
Note that you can achieve this in many different ways, some are more efficient that others depending on the complexity of your actual use case and the number of rows involved. Key point for me here is to stay way from loops.
I input the words (fruits), set the rules (terms)and apply the cross joiner (default settings). This basically means that every single fruit gets associated with every rule initially. Note that I already used wildcards for later use in the Rule Engine.
Next, I’m checking if the word satisfies any of the rules on a row basis by using the Rule Engine (many alternatives available here, same principle) whereby;
$text$ LIKE $search_term$ => "TRUE" //checking if the text contains the search terms if so it's TRUE
TRUE => "FALSE" // if not found, it's FALSE