I’ve always wondered, does this actually happen? People not getting fired because they are irreplaceable partly because of their own failure to document stuff?
When the newcomer can't get anything out of that doc, if it exist, he/she just need to ask the creator, who will explain very nicely how everything is done, and that newcomer become a code guru in that codebase, and the cycle continues.
Until you layoff 50% of the team and now suddenly nobody knows how 50% of the stuff work.
Ironically, the worse they are (think 5000 lines of Perl with two functions) then the less viable it is to replace them.