You could do the detection and color replacement from PB but you'd have to do the text addition from outside PB.
I was thinking about this a bit more last night. You could do the text replacement if you rasterized the text and passed it into PB as an image. You could then composite the text image with the host image in a sort of faux-green-screen process. That said, whether PB is the right solution remains to be seen. I'll let others comment on possible solutions.
should check, is this for Flash or Photoshop/After Effects? Part of this might be easier in full Pixel Bender (using a graph to get the box that you are looking for) and parts would be easier in Flash (the text compositing).
It should be possible, but it would be somewhat complicated either way.