A very thoughtful and hard question indeed; it pushed me to research a bit on the subject Continuous Conditional.
Your first example is a past perfect continuous sentence. In general, it is used to indicate an action was happening before another action happened. However, it can also be used to indicate past unreal condition. For example:
If I had been talking to him when he said that, I would have punched him in the face.
But fortunately, he was not talking to him when he said that and that's how he missed my punch.
So according to this theory, your first sentence which is
If I had been with you, I might be taking care.
is absolutely meaningful and grammatical.
Now, there is a vital fact when using these type of constructs as described by data.grammarbook.com,
When talking about something that didn’t happen in the past, many English speakers use the conditional perfect (if I would have done) when they should be using the past perfect (if I had done).
For example, you find out that your brother saw a movie yesterday. You would have liked to see it too, but you hadn’t known he was going. To express this, you can use an if – then clause. The correct way to say this is with the past perfect in the “if” clause, and the conditional perfect in the “then” clause:
Correct: If I had known that you were going to the movies, [then] I would have gone too.
The conditional perfect can only go in the “then” clause — it is grammatically incorrect to use the conditional perfect in the “if” clause:
Incorrect: If I would have known that you were going to the movies, I would have gone too.
More examples:
Correct: If I had gotten paid, we could have traveled together.
Incorrect: If I would have gotten paid, we could have traveled together.
Correct: If you had asked me, I could have helped you.
Incorrect: If you would have asked me, I could have helped you.
The same mistake occurs with the verb “wish.” You can’t use the conditional perfect when wishing something had happened; you again need the past perfect.
Correct: I wish I had known.
Incorrect: I wish I would have known.
Correct: I wish you had told me.
Incorrect: I wish you would have told me.
Correct: We wish they had been honest.
Incorrect: We wish they would have been honest.
So this theory, in a nutshell, says you can't use "would" part with the "if" clause, rather it should be used in the result clause. So, according to this theory, your second sentence stands incorrect.
You're perhaps not recognising the particular verb here, one of several different uses of have:
- have to means be obliged to, or must
So would have had to means would have been obliged to.
Best Answer
Your second sentence is a correct third conditional form as these forms are taught to English language learners.
Your first sentence has a difference in nuance that is not necessarily grammatically incorrect but doesn't conform to how the forms are taught. While the result (having gotten the flu) is in the past and can't be changed, there's an implication that you could still change your habits and start eating more fruit, and that if you do, you could possibly avoid repeating the result and getting the flu again.