That might be the case, but throwing out large pieces of somebody else's code without talking to them about it is not a civilized way to behave.
If I saw a problem with somebody's code, I'd try to patiently explain to them what the problem was, and how it could be done better. If they ignored me, I'd make my case to our manager in a rational way and let them decide who was right.
If the manager thinks that just throwing out somebody's code is acceptable behavior, I'd agree with the people who advised looking for a job elsewhere.
The problem here actually sounds like this coworker is used to working alone and doesn't know how to work on a team.
While we are going down the path of wild speculation in the absence of any evidence, I have found these types of "dissings" are a reflection of the dissee being more competent than the disser.