I think your 99% number is way off, I think lots of companies put internal applicants on a reasonably fair footing for lateral and upward moves. Not out of any desire to reward loyalty, but because the worker is a known quantity familiar with the internal culture, and because the fact that they are applying for such positions means it's also likely that they are considering outside positions and that if they don't get an internal job they are likely to take an external one and leave the existing position uncovered anyway.
This in my experience vastly overestimates the competence of middle management. Most programmers are not employed at FAANG or startups but at companies that view them as a cost centre and a replaceable cog.
Sure, a transfer from team A doing line-of-business applications in Java to team B doing line-of-business applications in Java is probably straightforward, especially around the time that team A's project goes live and team B's project is just ramping up.
But if our hypothetical Java dev was bored of Java and wanted to do something completely different, and would take some time to get up to speed in the new thing, that would be a harder sell, and ironically gets harder the better you are at your original job. Say you had been cranking out CRUD apps in Java and had a reputation for it and decided that you wanted to do machine learning all of a sudden. I think you would struggle to do that even in large companies. The best you could realistically hope for would be a promotion within your current silo. Unless you went somewhere you could start afresh.
Companies where engineers can flit around due to boredom are few and far between. In 99% of companies you are in a position because a company needs someone to do that thing specifically, and you might have your eye on something else internally but it's less risk for management to hire someone new into that position than it is to leave your position uncovered. And you are not there to learn, it's nice if you can learn of course, but the company is paying you to do the thing you do right now, giving the reason that you simply want to learn something new isn't a compelling reason for an internal transfer for most companies, for that reason.