The guy’s code worked? Doesn’t sound unreasonable that the project leader would want it merged. Put the technical debt on the backlog, get on with writing other code that works.
The project leader presumably had a team to manage. Seems perfectly understandable that they would want all their team contributing, even if some team members were vastly more productive than others. The alternative is over-reliance on key personnel, or back to the recruitment treadmill (both of these are risks and uncertainties - which it’s the PM’s job to manage down).
The project leader should want his less skilled employees to grow their skills so that he may one day have a greater breadth and depth of talent at his disposal. It might even be reasonable for the leader to want his most talented developers to do nothing but coach junior colleagues - particularly on a typical project that isn’t rocket science, where 5 average developers will be more useful than one rockstar.
Like I said, I don’t know your situation. My point is that the behaviour you describe seems like it could be quite normal and rational and not motivated by PCness at all.