why would Pakistan Air Force try to co-develop a fighter based on a design which is inferior to the F-16s it was already operating
Because basing(i.e.using parts of design which do their job just fine and not reinventing the wheel) in no way is simillar to being an inferior aircraft. It is about keeping commonality.
Was this commonality worth it? Well, for sure it was. Later production Mig-21 costed less than IFVs(bmp-1 itself being cheap as f), remaining viable combat aircraft well into 1980s.
If anything, mig-21/j-7 represented something very sought after, a quality modern aircraft industry doesn't really want to produce.
Jf-17, btw, is closest thing to this niche availible.
Furthermore, f-16 is a very interesting take. Technological level of early f-16 was extremely high, it was literally wonder sitting on another wonder: piece-of-art wing design, extremely light yet durable internal structure, controls, high instability and more, all this flying on single powerful yet reliable engine. It won't be a stretch to say what no ciuntry other than the US could use same level of decisions in 1970s and even 1980s.
Yet...and what? You can't kill anyone by exquisite titanium framing, other than in melee fight. With all these extreme tech, early falcon was inferior fighter design to both internal and external competitors, and had to play catch up game already by late 1980s.
Yes, some of decisions in jf-17 clearly date back to original mig-21. Those which won't affect its performance in measurable ways, or those which are simply unviable to replace for their ultimate advantage.
The whole fc-1 program was about spending money in the most optimal way.