This is where the economy system starts to break down and not make a whole lot of sense, IMO.
Your colonies' demand does not count towards increasing the potential income you can make. That is to say, even if you have 1000 planets all demanding 5 food, and no other faction exists, you will be losing money because you can't export anything.
In your example, assuming no other faction exists, your planets with demand 7 and 8 will both be suffering a permanent food shortage of 1 and 2 units, respectively. The others will all be supplied 100% in-faction
Assuming the normal sector, those planets will get supplied 1 to 2 units through imports because there are vanilla colonies that produce at least 8 food.
Assuming infinite accessibility, only the highest supply matters, and is able to support an infinite number of planets' demand. If you have 1000 planets all demanding 5 food, and you have one planet that produces 5 food, all of your planets will be supplied in-faction. You could call supply and demand units logarithmic, but then the export value calculation should not be linear.
EDIT: In case it was not clear, in your second example, you will have a larger food shortage because only the world producing 5 really matters.