You're incorrectly conflating question quality with question difficulty. The two are very different concepts, even if they do often overlap.
Questions are not downvoted because they are easy to solve, just like questions are not upvoted just because they're hard to solve.
Questions are evaluated based on quality metrics such as doing sufficient research, being clear, being answerable, containing sufficient information, being appropriately scoped, etc.
When first learning a particular concept (programming or not) there tend to be a lot of frequently asked questions, and as a result, a lot of quality, discoverable information answering those questions. Because of this, questions asked by users new to a particular topic are usually poorly researched (when the author does do their research, they find the answer and don't need to ask the question). When the answer to a question isn't discoverable then the questions do tend to be well received, regardless of difficulty.
Questions from such users also have a higher probability of being unclear, inappropriately scoped, lacking important information, etc. because the user lacks sufficient knowledge of the topic to properly form a question. While this may or may not have "inexperience" as a root cause, the fact remains that the site's feedback is purely on the quality of the question, not on its difficulty.
When beginners do ask quality questions that meet the site's guidelines then they tend to be well received. When experienced programmers ask hard questions that don't meet the site's quality standards they generally aren't well received.
So while there is a correlation between beginner questions and downvotes, there is no causation.
Questions aren't downvoted just for spiteful pleasure. Low quality questions are downvoted because it's the best way to help maintain the health of the site. It provides a useful signal to other potential readers that the question has problems, it tells the author that the question is currently not up to the site's standards and should be improved, and it helps inform the system's evaluation of the user, so that if they fail to learn from their mistakes and repeatedly post problematic content the system can help deal with that problem.
At the end of the day it is the user's responsibility to ask a question that meets the site's standards. We provide tons of resources to help people ask good questions, in the help center, on meta, as comments on questions that have problems, through close reason text, through editing, and so on. While we do try to do a lot to enable users to ask good questions, we can't do everything, and many of the things we can do (editing, comments, etc.) are very time consuming and draining on the community.
While it would be nice for every single question to get personalized and detailed feedback on it's quality from multiple different users, there simply aren't enough people willing/able to tutor every single new user in how to ask a good question (because after all asking good questions is hard). While users are encouraged to help out when they can, to the degree that they want, they are not obligated to hold the hand of every single user through the question asking process. At some point responsibility falls to the author to learn how to ask a proper question.