People who are the most passionate about programming are the same people who tend to identify with the code their code! If you say the code is wrong, you are also saying they are wrong. You can mitigate this type of territorial response by convincing them to disassociate their identity from a code block. We aren't a group of rockstars writing hit after hit, we are a team of engineers iterating through possibilities and routing around roadblocks.
For dealing with intergroup rivalry you're better off going to the group responsible for that area first to show your results. Get their support before going up the ladder. Let them be part of the success. Otherwise you paint them into a corner when the big boss comes down and says "Why are other teams fixing your problems!?" Now they must attack your solution to justify themselves.
edit: I'm seeing a lot of other threads say "Just don't work at places where this is an issue." When you find robot planet let me know, because this is an issue everywhere. With your customers if not with your co-workers.