In my experience as a game designer, and from what I understand from some of the more accomplished game designers, is that level design has its foundation in game play. That is, core mechanics of the game are determined first, such as walking, running, jumping, climbing, wall jumping, etc... and they are perfected in a sandbox environment. Usually a game's mechanics are based on accepted norms within the genre, and then will have one novel concept that differentiates it from every other game in that genre. A platformer where you always have the ability to fly (owlboy), luigi's ghost vaccuum in a standard mario 64 environment, a puzzle game where you level up characters (puzzle quest). Anyway, once all of that is decided on, built, tested, and perfected, you can start on level design.
Level design should direct players in such a way that they experience the full gamut of gameplay you've created with your controls/mechanics. It should offer situations that are fun, like wall jumping up an enemy free chasm. It should also offer challenges that require players to master the mechanics of the game, such as wall jumping up a chasm that is rapidly filling with lava while dodging falling rocks from above. One important thing to avoid when designing levels are areas of frustration. If the controls for wall jumping are unresponsive, too touchy or limiting, a player may find themselves hating the game when they've died for the fiftieth time from a falling boulder because the arc of their jump always seems to put them straight into danger. To fix problems like that the controls need to be polished, or that part of the level needs to be remade to work within the parameters of the game. One more thing to consider when designing levels is that the level is clearly laid out for the player. Even if there are puzzles or mazes to solve, a level needs to be designed in such a way that a player knows that there is a puzzle to solve even if the solution isn't apparent. For mazes, it could be suggested that individual parts of it should be unique from each other in order to provide reference points for the player. Ghost houses from Super Mario World are a perfect example of this last point. The player goes through an endless loop of the same part of the house until they learn to take the correct path, when they finally take the right path it is immediately clear that they did. Expanding on this concept, and wrapping things up, is the concept of rewards or rewarding moments in your level design. Good level design should recognize a player's accomplishments and reward them accordingly. Just getting out of the ghost house is rewarding enough, but when you find the secret exit to the level it would reward you with the elusive 3-up moon. When it comes down to it, all level design is is a way for a player to fully experience the game that you've created in the most enjoyable way possible. It should throw them into the world, teach the basics, build them up in skill and confidence by giving them ever increasing challenges, provide them opportunities to feel smart about what they've learned, and reward them every step of the way.