The ability to write code that can compile is not an indicator for programming skill.
No, it is not an indicator of programming skill. It is an indicator of something much more fundamental which is whether they are even qualified to be programmers. Somebody who cannot even write code that compiles is essentially not qualified to be called a programmer and it won't matter whether they can copy code from online sources if they do not have enough skills to put it in place, correct minor issues and make the code compile.
The problem is colloquially referred to as the jugaad mentality which is due to the lack of discipline. Because we lack the infrastructure present in first-world countries we've become too complacent, finding shortcuts to solve problems. The most common example of taking a shortcut is using a thick piece of paper to balance a wobbly table.
There is nothing bad about finding jugaad solutions that work as long as they have a solid basis. Jugaads is what I call out of the box thinking and its a highly desirable trait even among skilled programmers. In everyday professional programming, you often need those kind of solution. Bill Gates is supposed to have once said that he would give the hardest job to the laziest person because he would find an easy way to do it. There is nothing wrong with that kind of jugaads. For instance, if I need to write a program to find sum of first "n" odd numbers, I can write a program with a loop to generate and add n odd numbers and give the result or I can use my knowledge of basic high school math and arrive at the more efficient and shortcut solution of just giving the result as n*n. Similarly, there is nothing wrong with just copy pasting code from some online code as long as you are not violating some copyright and you understand what your copied code does. Nobody is asking you write everything from scratch all the time. but you need to be able to write it from scratch if required.
One embarrassing (and rather ironical) example is when Indian interviewers continue to, even after hundreds of interviews, assess the skill of a candidate by testing their knowledge on data structures and algorithms. The problem lies in the fact that most Indian developers do not know where data structures/algorithms end and where large scale software development (maintainable, testable) begins. I agree that at some point, though the occurrence is rare, developers will find themselves discussing how to optimize O(n log(n)) into O(n) runtime.
There is a reason for that practice. Everyone doesn't need to know how a B+ tree works, but the bare minimal fundamentals of DS and algorithms is essential for even the JavaScript Web developer. I have interviewed people with over 10 years experience who claimed to have never heard the term "time complexity". In fact, they can't name an efficient sorting method algorithm and some can't even differentiate between searching and sorting. One guy even questioned me why algorithms even matter for every day work. I simply asked him how he would maintain a leader board of scores and how he would customize it so that new entries can be added to the board on the fly. In fact, leave alone knowing the internals, many of these people cannot write a solution with standard library functions.
People without the fundamentals make for lousy programmers. Even if they write code that works, they usually end up with badly written and inefficient code full of multi level nested loops. Such code is always a liability. A service that should handle the necessary load with a single instance will require 10 instances to handle the same load. Imagine the cost of hardware and other resources like electricity and bandwidth and maintenance.
In the early stages of my career over 12 years ago, I was given an issue to resolve. The application that we worked on was hanging while opening a document made in an earlier version. The document has to go through a conversion process which was working fine for small documents, but this one had over 2000 pages with lots of different formatting styles. The issue was looked at by several senior level programmers before it it was assigned to me. The first thing I noticed was that it was not hang, but just the conversion process taking time. I let it run till it completed and time it. It was taking nearly 26 hours to convert and open the document. I checked out the code there was a 4 level nested loop with time complexity of O(n pow 4). It took me about 20 min to write the code to O(n log(n)) and the conversion process which was taking 26 hours came down to under 2 minutes. It all boiled down to knowing the basics of algorithms and time complexity.
There were numerous instances like this through out my career. I have found O(n pow 3) loops in server code that resulted in 10 tens of thousands of dollars in costs due to poor scaling. I would rather pay more for a programmer with good fundamentals who can write decent code than pay less for a crappy one without fundamentals and waste thousands or even millions in completely unnecessary continuous maintenance costs.
It is not even a matter of discipline. People these days don't even seem to have the fundamental curiosity of learning the in's and out's of their chosen subject. Not having good teachers is not even close to an excuse. Especially not for Computer Science/IT. Most people these days have access to computers and internet. what else do you need apart from some curiosity. Back when I was still doing my B.Tech, I had a junior guy who didn't have a computer, but still practiced programming on his Texas Instruments graphing calculator.