For me, it's always been a balance of sustainability, maintainability, and competitive advantage: What happens when I leave the company? Who's going to fix my bugs and restart the server? And then there's the flip side: If we don't innovate, isn't that the same as giving an advantage to our competitor?
And this is exactly why programming makes you more valuable and puts you in a much better position to negotiate promotions. You give them better "machinery" for better productivity, but they need you to operate it! Now if you leave they are taking a significantly larger step back than if you hadn't built things for them in the first place.
I didn't learn to program because I wanted to keep my job. I learned programming because, frankly, it was fun and challenging.
When I was in a sales support job I went as far as writing an web application hosted on my machine so I could share it with my colleagues in the building. It let us do ad-hoc reporting on certain figures that weren't captured in the company's official data mart, but it wasn't very scalable or maintainable, especially once I left that company.
But building little tools that make you and your colleagues more productive can add to your value and desirability as an employee. For the employer, the tradeoff of tolerating an "underground" code base existing on your employees' machines, is the productivity gains that come from it, which can really add up. Just by writing a script that automates a report, I can gift my employer thousands of dollars per year in productivity. Employers love employees who figure out how to automate their own tasks.