Doctor doofenshmirtz is more interesting and complex than jax tadc and i mean that with zero jokes
Jax is mean because trauma which makes him push away people
Doctor doofenshmirtz is evil because he doesnt understand societal convention due to childhood neglect and sees basic self-survival tactics as evil, and decides to embrace that comically because of his lack of understanding, driving him to go great lengths to get revenge on people in a way that fails to endanger them, but rather to humiliate them because his whole ideal of self survival is an outward appearance of evil once again due to childhood neglect that shapes how he interacts with perry the platypus. Yes his revenge is cartoonish but this is because cartoonish is how hes learned to understand the world.
Jax uses archetypes as a tool to dissociate and build walls, because he doesnt want to face the music.
Dr. Doofenshmirtz understands the world as self vs society. Everybody else and everything else creates his problems. He often is well meaning. He loves his daughter, but his understanding of the world as self v society means he wishes to minimize the worlds problem causing effects on his daughter. Him and his ex wife have a healthy divorce just because they werent meant to be. Doof understands that as a societal problem and his uprbringing just like how clark backrooms externalizes fault in order to protect himself and his desire not to change