The problem can be solved by replacing the formalistic and static point of view with a dialectical one. The Marxian proposition simply needs to be made more "dynamic". The dominant ideology of every society is the ideology of the dominant class in the sense that the latter has control over the means of ideological production which society has at its disposal (the church, schools, mass media, etc.) and uses these means in its own class interests. As long as class rule is on the upswing, stable and hence hardly questioned, the ideology of the dominant class will also dominate the consciousness of the oppressed class. Moreover, the exploited will, as a rule, tend to formulate the first phases of the class struggle in terms of the formulas, ideals and ideologies of the exploiters. 
However, the more the stability of the existing society is brought into question, and the more the class struggle intensifies, and the more the class rule of the exploiters itself begins to waver in practice, the more will at least sections of the oppressed class begin to free themselves of the control of the ideas of those in power. Prior to, and along with, the struggle for the social revolution, a struggle goes on between the ideology of the rulers and the new ideals of the revolutionary class. This struggle in turn intensifies and accelerates the concrete class struggle out of which it arose by lifting the revolutionary class to an awareness of its historical tasks and of the immediate goals of its struggle. Class consciousness on the part of the revolutionary class can therefore develop out of the class struggle in spite of and in opposition to the ideology of the ruling class. 
But it is only in the revolution itself that the majority of the oppressed can liberate themselves from the ideology of the ruling class.  For this control is exerted not only, nor even primarily, through purely ideological manipulation and the mass assimilation of the ruling class’ ideological production, but above all through the actual day-to-day workings of the existing economy and society and their effect on the consciousness of the oppressed. (This is especially true in bourgeois society, although parallel phenomena can be seen in all class societies.)
In capitalist society this control is exerted through the internalisation of commodity relations, which is closely tied to the reification of human relations and which results from the generalised extension of commodity production and the transformation of labour power into a commodity, and from the generalised extension of the social division of labour under conditions of commodity production. It is also accomplished through the fatigue and brutalisation of the producers through exploitation and the alienated nature of labour, as well as through a lack of leisure time, not only in a quantitative but also in a qualitative sense, etc. Only when the workings of this imprisonment are blown apart by a revolution, i.e., by a sudden, intense increase, in mass activity outside of the confines of alienated labour - only then can the mystifying influence of this very imprisonment upon mass consciousness rapidly recede.
The Leninist theory of organisation therefore attempts to come to grips with the inner dialectic of this formation of political class consciousness, which can develop fully only during the revolution itself, yet only on the condition that it has already begun to develop before the revolution.  The theory does this by means of three operative categories: the category of the working class in itself (the mass of workers); the category of that part of the working class that is already engaging in more than sporadic struggles and has already reached a first level of organisation (the proletarian vanguard in the broad sense of the word);  and the category of the revolutionary organisation, which consists of workers and intellectuals who participate in revolutionary activities and are at least partially educated in Marxism.
The category of "the class in itself" is linked to the objective class concept in the sociology of Marx, where a social layer is determined by its objective position in the process of production independent of its state of consciousness. (It is well known that the young Marx - in the Communist Manifesto and in his political wrings of 1850-1852, for instance- had put forward a subjective concept of the class according to which the working class becomes a class only through its struggle, i.e., by reaching a minimum degree of class consciousness. Bukharin, in connection with a formula from The Poverty of Philosophy, calls this concept the concept of "the class for itself" as opposed to the concept of the "class in itself.")  This objective concept of the class remains fundamental for Lenin’s ideas on organisation, as it did for Engels and the German Social Democracy under the influence of Engels, Bebel and Kautsky. 
It is only because there exists an objectively revolutionary class that can, and is periodically obliged to, conduct an actual revolutionary class struggle, and it is only in relation to such an actual class struggle, that the concept of a revolutionary vanguard party (including that of professional revolutionaries) has any scientific meaning at all, as Lenin himself explicitly observed.  All revolutionary activity not related to this class struggle leads at best to a party nucleus, but not to a party. This runs the risk of degenerating into sectarian, subjective dilettantism. According to Lenin’s concept of organisation, there is no self-proclaimed vanguard. Rather, the vanguard must win recognition as a vanguard (i.e., the historical right to act as a vanguard) through its attempts to establish revolutionary ties with the advanced part of the class and its actual struggle.
The category of "advanced workers" stems from the objectively inevitable stratification of the working class. It is a function of their distinct historical origin, as well as their distinct position in the social process of production and their distinct class consciousness.
The formation of the working class as an objective category is itself an historical process. Some sections of the working class are the sons, grandsons, and great-grandsons of urban wage labourers; others are the sons and grandsons of agricultural labourers and landless peasants, Still others are only first or second generation descendants of a petty bourgeoisie that owned some means of production (peasants, artisans, etc.). Part of the working class works in large factories where both the economic and the social relations give rise to at least an elementary class consciousness (consciousness that "social questions" can be solved only through collective activity and organisation). Another part works in small or medium-sized factories in industry or in the so-called service sectors, where economic self-confidence as well as an understanding of the necessity for broad mass actions flow much less easily from the objective situation than in the large industrial plant. Some sections of the working class have been living in big cities for a long time. They have been literate for a long time and have several generations of trade-union organisation and political and cultural education behind them (through youth organisations, the workers press, labour education, etc.). Still others live in small towns or even in the countryside. (This was true into the late 1930s, for instance, for a significant number of European miners.) These workers have little or no collective social life, scarcely any trade-union experience, and have received no political or cultural education at all in the organised workers movement. Some sectors of the working class are born from nations which were independent for a thousand years, and whose ruling class oppressed for long periods other nations. Other workers are born from nations which fought for decades or centuries for their national freedom - or who lived in slavery or serfdom no more than one hundred years ago. If one adds to all these historical and structural differences the various personal abilities of each wage worker - not just differences in intelligence and ability to generalise from immediate experiences, but differences in the amount of energy, strength of character: combatively and self-assurance too - then one understands that the stratification of the working class into various layers, depending on the degree of class consciousness, is an inevitable phenomenon in the history of the working class itself. It is this historical process of becoming a class which, at a given point in time, is reflected in the various degrees of consciousness within the class.
The category of the revolutionary party stems from the fact that Marxian socialism is a science which, in the final analysis, can be completely assimilated only in an individual and not in a collective manner. Marxism constitutes the culmination (and in part also the dissolution) of at least three classical social sciences: classical German philosophy, classical political economy, and classical French political science (French socialism and historiography). Its assimilation presupposes at least an understanding of the materialist dialectic, historical materialism, Marxian economic theory and the critical history of modern revolutions and of the modern labour movement. Such an assimilation is necessary if it is to be able to function, in its totality, as an instrument for analysing social reality and as the compilation of the experiences of a century of proletarian class struggle. The notion that this colossal sum of knowledge and information could somehow spontaneously flow from working at a lathe or a calculating machine is absurd. 
The fact that as a science Marxism is an expression of the highest degree in the development of proletarian class consciousness means simply that it is only through an individual process of selection that the best, most experienced, the most intelligent and the most combative members of the proletariat are able to directly and independently acquire this class consciousness in its most potent form. To the extent that this acquisition is an individual one, it also becomes accessible to other social classes and layers (above all, the revolutionary intelligentsia and the students).  Any other approach can lead only to an idealisation of the working class - and ultimately of capitalism itself.
Of course it must always be remembered that Marxism could not arise independently of the actual development of bourgeois society and of the class struggle that was inevitably unfolding within it. There is an inextricable tie between the collective, historical experience of the working class in struggle and its scientific working out of Marxism as collective, historical class consciousness in its most potent form. But to maintain that scientific socialism is an historical product of the proletarian class struggle is not to say that all or even most members of this class can, with greater or lesser ease, reproduce this knowledge. Marxism is not an automatic product of the class struggle and class experience but a result of scientific, theoretical production. Such an assimilation is made possible only through participation in that process of production; and this process is by definition an individual one, even though it is only made possible through the development social forces of production and class contradictions under capitalism.