Assuming this story is real, there are several smells
* Colleague writes quite a bit of code, and merges it without anyone reviewing it or providing feedback.
* OP rewrites the code from a colleague without communicating, and again merges it without a review.
* The manager calls a meeting with OP and ask them to revert their changes.
The initial code might have been messy or not, and the refactor might have been a bad or good idea. Nevertheless I think OP is taking away the wrong lesson.
* Colleague writes quite a bit of code, and merges it without anyone reviewing it or providing feedback.
* OP rewrites the code from a colleague without communicating, and again merges it without a review.
* The manager calls a meeting with OP and ask them to revert their changes.
The initial code might have been messy or not, and the refactor might have been a bad or good idea. Nevertheless I think OP is taking away the wrong lesson.