We've got this silly tendency to glamorize the concept of being irreplaceable. "Yay!" you say, "I can be so cool that, even if I have a bad day, the company will lay every other engineer off before they get rid of me! I'm irreplaceable!" This is often about luck. Being the last guy to actually understand JCL at a shop that can't quite get rid of their last mainframe, for example. This isn't something you plan for.
On the other hand, Gordian knots fall prey to scissors. Everybody's irreplaceable right up until the day they aren't. And the level of stagnation that leads a person to be content with being the irreplaceable guy with stuff in his head will not work in your favor, long-term. You find yourself jobless and without any marketable skills.... or, even worse, without the sort of marketable skills you'll need to work in the sort of company and location you want to be working.
Your brain is just a muscle. If you bike every day for 10 miles, eventually you'll have impressive leg muscles. But if you take a few years off, those muscles will atrophy. The same is true for your brain. Thus, I tend to think that the same skills that enable somebody to become an irreplaceable hacker when luck strikes... largely having to do with the ability to learn and intuitively understand something... are skills that will serve you well as a smart hacker in any variety of areas. And, as far as I can tell, smart hackers who can dive into something that's never been done before and not flinch... those are the true bedrock gold nuggets of the tech industry.
Except that if you stay too long as a lucky hacker, those same skills will atrophy. But, as far as I can tell, it's not an especially career limiting move to be replaceable but still very smart.