Most developers I've worked with have opinions about the UX, and often they can be valid. A lot of the time they cause more headaches than desired but that's primarily down to a lack of communication across the team. Communication is the antidote in this instance. I'll talk about some best practices and ideal scenarios that should help to illustrate some strategies for dealing with this dilemma:

Good Developers

A good developer will defer to the UX team when an issue arises that might affect the user - not because they are monkeys that don't know what to do, but because they respect that it's your role to investigate and solve the problem. If they have opinions on what the solution might be, they should share it but equally as a UXer you should ask them if they have any thoughts about how the problem might be solved. It doesn't mean you have to run with it, but maybe it's the best idea ever! You never know.

Good Designers

Likewise in good teams the UX designers will include developers in their process. Not all the time and not every day necessarily, but certainly at key points. Developers are naturally inquisitive problem solvers - if they just get lumped with answers but can't see the thinking behind them, they're bound to want to question your motivations and workings. Over the long term they'd harbour resentments if they didn't feel free to question UX.

In practice

One example of what I've done previously over a UX cycle investigating a particular feature (albeit a reasonably large one) would be to invite one or two devs to the initial kick off meetings and some following workshops. That way they'll get a good insight into what you're trying to achieve and why, and have a chance to provide input and feedback. This gives them a sense of ownership in the outcome, which is invaluable in maintaining team morale. After that, as the designs are evolving and feedback is being sought by the PO's etc, I'd occasionally have the devs in again to get their take on the design iterations. This isn't always ideal, but if you're skipping this part then you'd at least be advised to arrange a meeting as you hand over the project from design to dev. That way all parties can voice their concerns and remind each other of their respective roles in the process. (I hope a hand over meeting goes without saying...but you'd be amazed!)

In addition: along the journey there will be various user testing sessions and feedback from parties involved and it's important to document these all somewhere that is accessible to everyone. Lots of devs I've worked with enjoy poking around the UX documentation and understanding what went on.

Further reading

One really great book about UX that has a section on relationships between UXers and the team at large is Under Cover User Experience Design by Cennydd Bowles and James Box http://undercoverux.com/. It's a little dated in some aspects but it's filled with great insights and timeless advice.