These are all very different extended gaps. The first two should be fine - if someone's skills have atrophied than that's another issue (but nothing a good interview or probation period won't pick up on if it's actually even a problem). The second one might be fine or a problem - and I can see why employers would be wary.
Absolutely agree.
When I interview people I couldn't care less about any gaps in their resume, we're going to sit down, talk about tech, what you've done and what we need, etc. If there's a match in skills, needs, personality and expectations then that's it, anything else are invisible cargo-cult walls
Also working doesn't necessarily equal keeping up with technology. If i'm maintaining some legacy system, I wont have a gap but i might've not learnt anything new for years.
It's a broad statement, so keep it in context. Examples: Think, Apple has had the iPhone out since 2008 now. Working there on the iPhone 16 HW / SW specs or the M3 processor design may well be cutting-edge stuff, but working there as SRE for the App Store infrastructure is likely "an SRE job with some legacy in it". And working on their developer infrastructure, devtools / CI etc, very very likely is full of "proprietary dead ends" (i.e. tech noone outside the AAPL orchard will use or have use for). A Wall Street bank, once above a certain size, is going to adopt tech more slowly - much of their proprietary software stack is likely still in C++ / Java where a five-year-old small trading house may have written all that in Rust.
I've had jobs at such "S&P 500" corporates in the past; I wouldn't say "I learned nothing" - I learned how to navigate companies. Call it "coping strategies" if you like. It still helps to get stuff done knowing how-to-do-it on a procedural level - or via human-interaction. Tech-wise ... regretted some of these. My experience, though, is that one can "come back".
"Just" keep the ambition under control that you need to know everything, and need to be able to do everything. Today's "tech stacks" have so many parts in it that are out of your control and that you cannot inspect - the sheer will to "rule them all" will burn you. It's easier said then done, but: know your limits. Everyone has them. You'll recognize the "boasters" soon enough, those that claim they can rule it all.
The fact is that the IT world does not progress in a linear direction. It's like a puddle that grows into multiple directions. But it is still covering most of the same spots as before. Banks still use COBOL. High-performance code is still in C or C++ with assembler (but that "C" may run on a GPU), etc.