Very close...but actually, given the inability of the current border popping code to see the value of a resource tile in the next ring whenever it’s adjacent to a (currently unpopped) non-resource tile in the inner ring, the solution would be to add a (negative given the current code) term to every tile it can currently see that's adjacent to a resource tile located in the next ring. The ring based qualification is necessary to prevent the code from increasing the attractiveness of a tile based on the availability of an adjacent resource located in an inner ring to which the Civ will already have access. IMHO, another (negative) term would then also need to be added, further increasing the attractiveness of popping the non-resource tile, if the outer ring resource was not currently possessed by the Civ.
The point you make re: food and riverside grassland having a greater value than resource tiles is an interesting one. Indeed, it’s essentially the same issue that @spicytimothy mentioned earlier: when does the value of a resource tile trump a non-resource tile? FWIW, I’m going to stick to my original notion – that resource tiles trump non-resource tiles – for the reasons that I mentioned earlier, but I can certainly appreciate your alternative view.
EDIT: I wonder, is there a solution based on: (i) increasing the value of tiles adjacent to resources as you suggest Polycrates and (ii) partly (relative to (i)) decreasing their value if the empire already has that resource available to it, to simultaneously increase the value of popping resources to which the civ currently doesn't have access and lessen the likelihood that a non-resource tile is attractive purely because the adjacent resource tile is inside it? Before we can get more specific, my guess is that we probably need to acsertain the point made by @jdog5000 and @Lyoncet: exactly how the game combines all these weights to choose the next hex to access.
As it happens, a variation of this kind of conditionality – in which the code looks secure access to resources, food or hammers depending on various criteria - or maybe IMHO even the tile focus in the city management screen - flashed into my mind briefly the other day, but I didn’t explore it further because I couldn’t establish what I regarded as sound criteria for the set of if statements at the end of your post. But, barring being able to implement the solutions just noted above, I think this is precisely what’s needed Krikkitone – a focus on popping borders to secure resources, food, hammers or gold according to various if...then... criteria. IMHO, the lack of if...then... statements (or equivalent) in the border code rather works against the notion of “intelligence” referred to in the OP.
I won’t comment on the specific figures you’ve mentioned because, to be honest, as I’ve mentioned in a few posts recently, I really want to spend far more of my limited leisure time going forward playing more EU3 as opposed to Civ 5 and posting on cfc.

To help those that continue to take this issue forward though, I wonder if you could explain a point re: your approach: does it (i) essentially maintain the approach used in the current code – gradually establish a circular border a hex at a time, save for prioritising resources, food, production or gold according to various criteria or (ii) actually look to start by ranking all tiles in the BFH (which is what the “range of 3” hints at), and then expand out to the most valuable tiles. If the former, then I’m not sure that the “range of 3” will suffice – see my reply to Polycrates above for more on this one. If the latter, how would expansion out to the valuable tiles occur?