I guess this commonly occurs in many fields at a certain level of seniority - the "managing a large system involving many people" aspect can dominate the domain-specific part, be it software engineering, accounting, manufacturing etc. As such I'm really glad I chose medicine rather than SWE (even though I've been writing and loving code for >35 years, and it was a real toss-up when I went to uni) because:
1. You can still stay very hands on, even as a senior clinician, especially procedurally.
2. If you so choose, there's a lot of variety in what you find yourself doing as a doctor (my mix looks like making clinical decisions / talking to patients / families / doing procedures / performing and interpreting ultrasound / going to other hospitals to retrieve super sick patients and bringing them back in ambulances / mentoring / teaching / coding / managing a clinical service / etc - but there are lots of other options too). I'm not sure if this kind of variety is as easy to arrange as a SWE? (though I suspect I'm about to be corrected, thanks in advance.) Variety is quite important if you're easily bored, which is a common problem for bright people.
3. Although AI is coming to all fields, I do think the impact will look more like "better tools", rather than "job replacement", or "vast reduction in number of people needed", for longer in medicine (at least in my area). As a breadwinner this is a not inconsequential consideration.
Hope you find the career you love, and that it leverages the work and study you've already done in some way.