I've done both. Got a BS in Mathematics followed by an MS in computer Science on an NSF fellowship. I worked a total of 6 years in tech following undergrad before starting medical school.

Now I'm finishing a residency in Ophthalmology. There's no answer to your question and it's honestly a really hard call that depends mostly on you. Here are some bullet points.

1. When I compare myself to the salaries my peer group have made over the last 7 years, there's no question that medicine was a losing financial proposition by comparison. At this stage it's not clear whether that would be true for you. There was a post two days ago by a hardware guy who transitioned to software and has saved 2.6 million - he's a year older than me and pulling a salary that's comparable to mine after residence but without all the lost income and sacrifice.

2. I love to operate and the effect I can have on individual people's lives is unparalleled. My best days in medicine are as good or better than my best days in tech. However, my worst days in medicine are...really bad. Overall, waking up and going to work everyday was much easier as an engineer. This is mostly driven by the amount of busy work that's built into clinical medicine. Constantly clicking through boxes, documenting defensively so you're not worried about getting sued. I'd estimate over 80% of my time at work is of this type.

3. The things you're hearing about corporatization and loss of physician autonomy are not overblown. Physicians are treated as replaceable widgets to be squeezed for every dollar. Waking up and having to see 40, 50, 60 patients a day in clinic is miserable. I'm introverted by nature but I am a competent actor so my patients like me. I sincerely enjoy the interactions, but it can be draining in a way that engineering was not. I didn't think hard enough about this when choosing a specialty. The trend of replacing physicians with not-as-good but good enough "providers" to lower costs isn't going away.

4. Don't underestimate the drudgery of software engineering. I don't have a ton of experience in this capacity, but maintaining a well-curated code base is about 20% problem solving and "Aha!" moments and 80% scut work. Sitting in a room all day looking at a computer screen is not right for some people.

5. This is closer to the answer to your original question. You're focused on age but...I think you need to be honest with yourself about you potential to succeed in a tech career. The field has exploded over the last couple of years and there are tons of people without a lot of natural affinity sort of grinding through a CS degree to get a job, but I suspect that the people who are getting FAANG positions are the 'naturals.' I suspect that most of the people on hacker news took the AIMEE or did USMO in high school, grew up building things, took graduate math/CS/physics classes as an undergraduate etc. This is very different from medicine where an average intelligence and a LOT of work can put you in the top of your class. If you aren't a 'natural' I'd say the answer to your question is a clear NO.

Conversely, if you feel like a fundamental part of your nature is not being fulfilled then I'd suggest you seriously consider just finishing the MD, getting through some kind of cushy intern year (i.e. a transitional year) and then trying to reboot your skills.

6. There's a LOT of variability in you day-to-day in medicine, have you looked at Radiology, Pathology or Occupational Medicine --> Bioinformatics (fellowship). These are mostly no-patient-contact specialties that have a lot of opportunities for innovation and tech.

As for the people who are suggesting you find some kind of job at the intersection of tech and medicine...I'm open to suggestions. I haven't found a lot of great opportunities but maybe I'm looking in the wrong places.