I'm afraid the math doesn't work on that....although, if Doof and Phineas' biological father were distantly related, like cousins or something, that could explain the resemblance between the two. And then Vanessa nervously asks Ferb, "But just to be clear,
we're not related--are we?" "No, we're good. We can shag like a couple of rabbits."*

Vanessa's eyes widen; there's a shattering-glass sound effect. "Well, gosh,
no wonder you don't talk very much, with that smut-mouth."
*...When all parties are of legal age, of course.