Not necessarily. In case you didn't know, your 20 years of service
only starts after you become a doctor for the Air Force. In our son's case it works as follows: 4 years USAFA (age 22), 4 years medical school (age 26), 3 years residency (age 29), subspecialty, add a year or 2. Now you are age 29-31.
THEN you have 5 years USAFA payback + 4 years HPSP payback. In order to retire, you have to add 20 years once you become a specialist at age 29-31. I can say with (near) certainty, our son won't want to have 20 years of disruption
on top of all of that medical school. Also, as a MD specialist (not so much as GP dentist), the ROI is pretty costly when comparing wages to pay outside of the military).. Meaning, a Midwest cardiologist for instance can make $400K+. MAYBE $200K in the AF (excluding resigning bonuses). It's an apples-orange comparison and infinitely more involved to calculate. But you can see that you don't want to study ROI if you take the Academy path + med school.

My free advice was for him to punt on USAFA for his UG. He pretty much had 100% paid for at the UofMN anyways. But he didn't do it for the money... He wanted something radically different.
In case you didn't know, "retirement" for a doctor is like any other 20 year officer; 1/2 your rank wage. So the majority of a doc's income is specialty pay + pre-tax housing allowances + re-signing bonuses. None of those extras are included in your 1/2 wage annuity for the rest of their life. Hence, most people who "retire" in the military don't really unplug like a 70 year old but rather go back to work.