That path is not uncommon, but I would advise careful planning before embarking on that route. I'm assuming you want to remain in uniform to finish out a career. J7
Time will work against you. If you go through flight school first and get designated, you'll be able to leave aviation at about the 10 year point. Then you hit medical school (4 years), then internship (1year). Most navy docs still go to the fleet before going back to residency, so add 2-3 years for your utilization tour. Then back to residency (2-6 additional years; more if you want to subspecialize). At this point you're over 40, and you're finally ready to start your "high-paying" military medical career.
Speaking of pay, at the 10 year mark, you'll probably be an O-4 in the decent part of the flight pay curve. If you get into USUHS, you'll revert to O-1 pay for the 4 years you're there, then bounce up to O-3 over whatever until you get back to the O-4 level. Medical pay will offset some of the losses in flight pay, but your base pay won't catch up for years. HPSP students get paid less. Non-scholarship students not only dont get paid, they incur massive debt loads going through med school.
So, if you think your budget can handle it, and you and your family can tolerate you essentially going back through flight school and deployments at age 40, have at it. Yeah, it's been done, but it isn't easy. Assess your motivations for what you're trying to achieve with your plan.
V/R