Even though, at this point being forced to do complex maths are going to reduce the attention of fellow readers, specially since we ignore more mechanics that we should in order to make those calculation interesting and useful for non min-maxers.
You want something that works for 'non-minmaxers'? Fine. Let's call the current population of the planet as X, the increase in maximum population from building one farm as Y, the current weighted average production multiplier of the planet (weighted to however you want the planetary production to be set in the long-run, not the short-run) as A, and the increase in that multiplier from building one production structure as B (i.e. if you build one new factory on the planet, the new weighted average production multiplier becomes A + B ). Then if the product (X+Y)*A is greater than the product X*(A+B ), you should build a farm on the planet; if the product X*(A+B ) is greater than the product (X+Y)*A, then you should build a production structure on the planet. If the two products are equal, then it doesn't matter which you build. You can also normalize X and (X+Y) to 8 (i.e. current maximum population divided by basic maximum population) to make use of smaller numbers. The weighted average production multiplier is calculated as
total_production_mult = wealth_frac*wealth_mult + research_frac*research_mult + industry_frac*industry_mult
where *_frac is the decimal representation of the percentage of planetary resources allocated to production type *, and *_mult is the planetary multiplier to production type *, which can be computed as
*_mult = 1 + sum(B_i*boost_i + total_level_i*level_bonus_i)
where B_i is the total number of structures of type i which provide percentage bonus boost_i (expressed as a decimal), total_level_i is the sum of the levels of the structures of type i on the planet, and level_bonus_i is the percentage bonus granted per level by structure type i, expressed as a decimal.
Thus, if you have a planet which currently has 1 farm for a maximum population of 12 billion people, three factories granting a total of +50% to manufacturing, and a market granting +10% to wealth on a world with 90% going to manufacturing and 10% going to wealth, and are deciding between adding a farm for +4.4 billion people or a factory for +60% manufacturing, X would be 12/8 = 1.5, Y would be 4.4/8 = 0.55, A would be 1 + 0.5*0.9 + 0.1*0.1 = 1.46, and B would be 0.6*0.9 = 0.54. So (X+Y)*A = (1.5 + 0.55)*1.46 = 2.993, while (A + B )*X = (1.46 + 0.54)*1.5 = 3, indicating that you should build the factory instead of the farm. I normalized the maximum population to the basic maximum population of 8 billion people, but there is no real need to do so. If, instead of a farm, we're considering building a food distribution center for +25% population, we instead make the computation as 1.25*X*A = 2.7375 and compare that to X*(A + B ). If the factory we were considering adding only increased the manufacturing multiplier by 0.5, then (A+B )*X = 2.865, and we'd choose the farm to maximize planetary output. Because the weighted average of the production multipliers is bounded above by the maximum individual production multiplier, you can use that multiplier instead of the weighted average and come to a similar conclusion, although the choice made using the maximum individual multiplier may be suboptimal depending on the exact weighting of the planetary output (in the example above, if the new farm were only to grant 4 billion new citizens and the new factory grants +50% production to the planet, using the maximum individual multiplier tells us that building the factory is as good as building the farm; however, since the planetary production is split 90% to manufacturing and 10% to wealth, the optimal choice is to build the farm instead of the factory, but there won't be a terribly significant difference; the more strongly one multiplier is favored over the others, the more accurate the use of that multiplier for the weighted average planetary multiplier becomes, and for greatest efficiency the production type with the highest multiplier should be the production type most favored by the weighting).
This will also work if adding 1 farm requires you to add N approval structures to maintain whatever approval rating you want the planet to have; the only difference is that instead of comparing (X+Y)*A to X*(A+B ) where B is the change in the multiplier for adding one production structure, B is now the change in multiplier for adding N+1 production structures.