(I can’t help with the question but I’ve got a bit curious. My reply can be considered a bit out of topic, hopefully it doesn’t distract the conversation.)
Is there a particular reason that you’d like to (or are already) logging caffeine at the milligram prrecision (which seems to be Apple Health default)?
I myself have a “no-caffeine-days goal” that’s set to 5 days/week without caffeine. This seems enough for me since I rarely drink more than 2 cups (~330ml) a day and I always make them at the same intensity. This is enough for me, since it helps me avoid mood and sleep related negative effects of caffeine.
When I read your question, and having assumed you have a similar goal to mine, I got thinking whether I’m underestimating the caffeine sensitivity of the human body