Improving primary education is a thorny problem. The methods that have been proven to work best are extremely harsh and unpalatable. The #1 proven best way to improve education performance is to institute a mandatory test at a certain point and then implement massive consequences for failing at that test. South Korea has one of these where basically your entire life's course depends on your age 18 CSAT score, and guess what? They have the best educated kids anywhere. Of course, that comes with a suicide rate triple the OECD average and a birthrate of 1.2 children per woman - because most families simply cannot afford to provide a future for more than one child. The only way for someone of average intelligence to get a remotely competitive score is to study 12+ hours a day every single day from age 13 to age 18, in addition to going to $10,000+ year private cram schools that teach you how to study even harder.
The higher-scoring European countries also have this, while the consequences are nowhere near as harsh as in South Korea, scoring poorly on their equivalent of a high school entrance exam at age 12-13 tends to get you routed into the "stupid" high school which tends to close off access to most higher education. Europe also has a much more rigid employment system than the US does, many positions simply cannot be held unless you have a degree from an approved list of schools, no matter what your skills or experience might happen to be. In the US it's hard to get your foot in the door without a degree, but if you manage to get in, nobody cares whether you have a degree if you have good performance and years of experience. In Europe for a lot of jobs, it doesn't matter how much experience you have or how successful you were, if you don't have that piece of paper, you can't get the job.
Second, you also have to look at how you're actually ranking the education systems. Remember that a B student only has 10-15 points of possible improvement, while a completely apathetic student has 100 points of possible improvement. A country full of nothing but mediocre schools will rank much, much higher than a country with some great schools and some complete shit schools, which is what the US has.