Karl Marx wasn't around to witness the rise of the Soviet Union led by Lenin and Stalin, but has Marx ever thought if Communism ever being ran in such a way. Leaders like Stalin, Mao, Pot, Kim Jung-Un, did he ever think this would happen? If so, to what extent?
The short answer is no because Marx envisioned communism taking place on a global scale.
For the long answer we will need to go into how Marx arrived at the conclusions he did and then compare them to what happened in the Soviet Union and other "Marxist-Leninist" states.
When Karl Marx wrote the Communist Manifesto, he summarized his position very succinctly:
The theory of the Communists may be summed up in the single sentence: Abolition of private property.
The manifesto, however, was just a short piece of propaganda targeted towards the social democratic parties in Germany. Marx would later go on to refine his original theory by identifying commodity production rather than private property as the defining feature of capitalism. The goal of the communists was not to overcome private property but rather to overcome wage labor (commodified labor) and commodity production itself.
So why is this important? When you want to understand what Marx envisioned a communist society to look like, you need to keep in mind that his theory was developed out of his criticism of capitalism. The communist society, as envisioned by Marx, would be born with the "birth-marks" of the society it evolved from. Commodity production will cease, but the distribution of goods will first take on the character of "to each according to his contribution." A worker puts in 10 hours on the shop floor, and receives an equivalent of 10 hours in goods from the communal social product. There are no independent producers, rather there is one "firm" that distributes all of the product.
What we have to deal with here is a communist society, not as it has developed on its own foundations, but, on the contrary, just as it emerges from capitalist society; which is thus in every respect, economically, morally, and intellectually, still stamped with the birthmarks of the old society from whose womb it emerges. Accordingly, the individual producer receives back from society – after the deductions have been made – exactly what he gives to it. What he has given to it is his individual quantum of labor.
-Karl Marx, The German Ideology 1845
This lower phase is commonly referred to as "socialism." As the productive forces increase, Marx predicted that the society would reflect the principle "from each according to his ability, to each according to his need." The birthmarks of capitalism would fade, and the social product would be enough that it would be distributed in a manner not determined by labor time.
Under communism, commodity production has ceased completely. While the new communist society will have the "birth marks" of the old stamped upon it, it will still represent a new mode of production entirely.
He states this explicitly in the Gothakritik:
Within the co-operative society based on common ownership of the means of production, the producers do not exchange their products; just as little does the labor employed on the products appear here as the value of these products, as a material quality possessed by them, since now, in contrast to capitalist society, individual labor no longer exists in an indirect fashion but directly as a component part of total labor. The phrase "proceeds of labor", objectionable also today on account of its ambiguity, thus loses all meaning.
Karl Marx, Gothakritik 1875
Keeping this in mind, from Marx's perspective, there is little that could be described as "socialist" or "communist" within the Soviet Union or other "communist" countries. While these states espoused a Marxist or Marxist-Leninist ideology they retained the institutions that Marx describes above as capitalism.
Stalin himself admitted that commodity production existed within the Soviet Union:
In our country, the sphere of operation of the law of value extends, first of all, to commodity circulation, to the ex-change of commodities through purchase and sale, the ex-change, chiefly, of articles of personal consumption.
Josef Stalin, Economic Problems in the USSR 1952
In addition to the existence of commodity production, Marx and Engels also thought that communism can only exist on a global scale. Commodity production could not be transcended "in one country" because one country alone could not overcome the social relations that mediated the production and distribution of goods and services in a global market:
"Will it be possible for this revolution to take place in one country alone?"
No. By creating the world market, big industry has already brought all the peoples of the Earth, and especially the civilized peoples, into such close relation with one another that none is independent of what happens to the others.
Frederich Engels, The Principles of Communism 1847
--
There is a lot of disagreement amongst Marxists and other contemporary communists as to the character of the Soviet Union and other similar states. But as to the opinions of Marx himself I think the case is clear he would've seen these societies as capitalist.
Edit(s): Grammar and spelling mistakes, corrected syntax errors. Corrected the last reference to reflect the correct date that The Principles of Communism was published (1847, not 1848)
MarxAndKnuckles has already responded, but I'd like to point out that Marx denounced "totalitarianism" in many of his historical works, such as in The 18th Brumaire of Louis Napoleon ,where he alleges that under the Napoleon, the state came to dominate every aspect of public life:
It is immediately obvious that in a country like France, where the executive power commands an army of officials numbering more than half a million individuals and therefore constantly maintains an immense mass of interests and livelihoods in the most absolute dependence; where the state enmeshes, controls, regulates, superintends, and tutors civil society from its most comprehensive manifestations of life down to its most insignificant stirrings, from its most general modes of being to the private existence of individuals; where through the most extraordinary centralization this parasitic body acquires a ubiquity, an omniscience, a capacity for accelerated mobility, and an elasticity which finds a counterpart only in the helpless dependence, the loose shapelessness of the actual body politic — it is obvious that in such a country the National Assembly forfeits all real influence when it loses command of the ministerial posts, if it does not at the same time simplify the administration of the state, reduce the army of officials as far as possible, and, finally, let civil society and public opinion create organs of their own, independent of the governmental power...
... its political interests compelled it to increase daily the repressive measures and therefore the resources and the personnel of the state power, while at the same time it had to wage an uninterrupted war against public opinion and mistrustfully mutilate, cripple, the independent organs of the social movement, where it did not succeed in amputating them entirely. Thus the French bourgeoisie was compelled by its class position to annihilate, on the one hand, the vital conditions of all parliamentary power, and therefore, likewise, of its own, and to render irresistible, on the other hand, the executive power hostile to it.
Marx then does on to describe how in such a totalitarian regime, the bourgeoisie become complicit in the suppression of even liberal ideas of public power in order to maintain their class status:
Thus by now stigmatizing as "socialistic" what it had previously extolled as "liberal," the bourgeoisie confesses that its own interests dictate that it should be delivered from the danger of its own rule; that to restore tranquillity in the country its bourgeois parliament must, first of all, be given its quietus; that to preserve its social power intact its political power must be broken; that the individual bourgeois can continue to exploit the other classes and to enjoy undisturbed property, family, religion, and order only on condition that their class be condemned along with the other classes to like political nullity; that in order to save its purse it must forfeit the crown, and the sword that is to safeguard it must at the same time be hung over its own head as a sword of Damocles.
This sheds some light on why many Marxists see capitalist democracy as simply a dictatorship of the bourgeoisie, and that depending on circumstances, capitalism can become autocratic or fascist for the sake of maintaining "order" - that is the material interests of the bourgeois state.
One other vital aspect of discussing Marx and 20th century authoritarian Marxists is the cult of personality, which Marx truly despised. In a corespondance with Wilhelm Blos, Marx stated:
I ‘bear no ill-will’ (as Heine says) and nor for that matter does Engels. Neither of us cares a straw for popularity. Let me cite one proof of this: such was my aversion to the personality cult that at the time of the International, when plagued by numerous moves — originating from various countries — to accord me public honour, I never allowed one of these to enter the domain of publicity, nor did I ever reply to them, save with an occasional snub. When Engels and I first joined the secret communist society, we did so only on condition that anything conducive to a superstitious belief in authority be eliminated from the Rules. (Lassalle subsequently operated in the reverse direction.)
This seems to be greatly at odds with the near-religious reverence in authoritarian 20th century states, yet another contradiction of Marx's theory in addition to the ones described in the top response.