I agree with most of the management advice here -- addressing employees engagement and boredom is probably one of the most important things you can do as a manager, and often the fix is simple (new project, new responsibilities, whatever).
That being said..
You know that old saying "if you're bored than you're boring"? I think most programmers that like programming are able to keep themselves entertained most of the time, if they feel like they're building something useful. Even things that seem mundane often have their moments.
In my experience as a programmer, my engagement almost has nothing to do with tech stack or stale technologies, it has to do with how useful I think the project is, and how much decision making autonomy I've been given in my little zone.
I get the impression with there being a new in-vogue web framework every three months and database and whatever, that people are just seeking novelty. Programming has become much more democratized in the last decade, which means a lot of people that wouldn't have otherwise been programmers are involved. That's mostly a good thing, but it makes me wonder if a lot of this novelty seeking is because not-particularly-challenging work is being assigned to people that are not-that-interested.