IT is similar to Admin jobs
If you are good coder and write clean maintainable code, you are disposable as you cannibalize your own job.
If you are a bad coder and write messy unmaintainable code, your company is forced to keep you.
cguy has a good answer to this, but basically if you work for a company where they would not notice it, the company is as bad as you.
I'd never get away with writing bad, unmaintainable code. First detekt would flag any obvious issues, second my colleagues would catch it during code review.
And if it got noticed that I turned in poor quality all the time that needed endless reviews to get up to standard, it would be noticed and let's just say that I wouldn't get much in the way of responsibility or raises.
There are some very, very experienced programmers above me and they'd notice such things. They'd be difficult or impossible to fool.
Of course, if your boss is non-technical, then yeah they won't notice. You can basically lie about how long a certain task will take and they will never know. I'd prefer to not work in places like that again. They all go nowhere for a reason.