Google has an internal system which allows engineers to transfer to other teams. If what you described happened to me, I would secure a transfer and then report the situation to higher ups.
IIRC that works only if you never got a bad performance rating, then nobody would touch you internally and your chance to transfer within Google is lower than to move to another company to a better level.