Ideally, this should be part of session zero before the game starts. The first thing a dungeon master should do is discuss with their players whether or not they want puzzles in their game in the first place. How can a dungeon master make these adjustments for a puzzle? How can they make a puzzle more difficult? Or easier? Roleplaying encounters can rely on the flow of performance in a scene and the outcome of a few rolls like persuasion, intimidation or deception. Combat design can be adjusted and readjusted to make the maths work.
Puzzles can also be absolutely frustrating to put together as a dungeon master.
Whether trading riddles with a creature for a ring or solving riddles for hints on how to outwit deadly traps protecting the Holy Grail, many players expect a brain teaser or two when on their adventures. The idea of solving a riddle or figuring out a strange inscription has precedent in the media that inspired Dungeons & Dragons. Puzzles are an important part of the RPG experience to many players and game masters.