The Bolshevik Party was just that: a political party. It organized itself on hierarchical lines and had various councils for propaganda, active revolutionary activity (organization of marches, armed insurrections, terror, espionage, counter espionage, etc.), as well as ideological policy. While the party devoted itself to a specific platform of political and socioeconomic change, and the methods and means of achieving this, it was not organizes as a shadow government or government in waiting as such. Once the October Revolution was successful the grass roots movements for low level and local power grabs - the Soviets: councils of workers or mutinous soldiers and sailors which decided what would happen within their purview, and were semi autonomous, although often were organized and largely controlled by Bolsheviks - were too numerous, uncoordinated and inefficient to govern. Soviets were effective means of revolutionary activity that supplanted the Tsarist government's practical power on the streets, but couldn't really run a nation.
Not long after the seizure of power and the dissolution of the Karensky Government, the ministries seized by the Bolsheviks in the coup were put under a new revolutionary organization called Sovnarcom (the Council of People's Commissars) while the party began organizing an entirely new form of government based on radical socialism while also having to defend the nascent government from outside intervention and a brutal civil war. The more radical the implementation of the Party's ideology became, the more clear that the most dedicated and ruthless party members needed to be at the center of all government and military organizations (such as political officers watching Red Army commanders to ensure there was no sabotage such as losing to superior enemy forces, or policemen showing insufficient zeal in arresting saboteurs). The Politburo (the group of senior party members that decided all policy in the Soviet Union) needed a general secretary as an organizer that could ensure that the most committed and reliable commissars were organized within the party and that those with insufficient zeal were removed from their post, expelled from the party and killed (if necessary).
None of the intellectuals in the Politburo wanted the job. It was thankless and unglamorous, and so was given to Stalin - an enforcer who'd proven himself a gifted organizer. Later his purview was expanded to organizing government posts to be staffed by party members as the party merged with the state to consolidate its power from top to bottom in the first truly totalitarian way. Stalin found himself at the intersection of the party's personnel department and the government and security apparatus right before Lenin died. He used the position to place people loyal to him and which were absolutely unscrupulous in their ruthlessness to methodically purge his real, then potential enemies. He played various ideological groups within the party against one another while he consolidated total control over the government and police, and - eventually - the party itself.