The Pakistanis order for 42 more aircraft was for a whooping $800million, or roughly $19 million an aircraft (plus supplies, support equipment, etc..). It just seems that for 5 or 8 million more you could purchase a J-10, which is a much more capable aircraft and has more room to grow.
You should make sure you are not comparing apples to oranges with such a simplistic analysis on contract price.
You need to look at the fine print of the $800m contract to see what is also included, as it is quite common for weapons, logistics, training etc to be sold as a complete package with the planes. All those extras don't come cheap.
What more, it would be silly to assume that Pakistan will get J10s at the same price as the PLAAF. Export planes are always more expansive than what the domestic air force pays, and its only fair since the PLAAF would have already pumped a huge amount of funds into the development of the J10, which is the overhead. The $25m is just what it costs to make a J10, for China to offer the J10 at $25m will be like selling it at below cost, which is never going to happen.
So if you factor out the extras in the JF17 contract and also mark up the J10 price to reflect realistic export prices and the price difference between the two for Pakistan would be quite considerable.
OTOH, since the PLAAF put no money into the development of the JF17, if they wanted to buy the type, then they would also need to pay a little extra then Pakistan (who did chip in with the development costs). So the price difference will be much smaller between the types for the PLAAF, which may be a big factor in their decision to opt for J10s.