When Marx talks about Labour being "Socially Necessary" he does so in a specific sense. From the perspective of some rational society there are many types of labour, which today not only exist, but which are highly remunerative, that would not be needed. In fact, Joseph Schumpeter pointed out that this was one way in which Socialism would be economically more efficient than Capitalism.
For example, today huge sums are spent on marketing and advertising. The labour time spent on these activities is not designed to provide consumers with information to enable them to make rational choices about commodities, but is instead designed simply to persuade consumers to buy this product rather than some other product, to depict some qualitative differecne between branded products that does not really exist, and to ensure that commodities produced by large producers, as part of a large scale long term production plan, find a market.
A society that geared its production to meet consumer needs would have no need of such wasteful and useless expenditure of resources. Similarly, huge sums are spent on litigation involving very highly paid lawyers, in respect mostly of issues surrounding disputes over property and contracts. A co-operative society would have no need of such expensive means of resolving conflicts where they arose, and the more property was collectively owned, the less such conflicts would arise. Adam Smith and other Classical economists themselves were at great pains to describe the huge waste of resources that was represented by useless functionaries such as the clergy, and the sustenance of whom, drained society's resources that could be better spent. Similar huge sums are wasted on other useless activities such as the maintenance of the Monarchy and its entourage, as well as the huge sums required to maintain a massive Capitalist State apparatus, and the machinery of Government. All of these wasteful expenditures of labour-time would be ended by a rational co-operative society.
However, within the context of a commodity producing society all of these activities can be considered socially necessary expenditures of labour-time. All that is required within this restricted meaning is that someone is prepared to buy the product of this labour as a commodity. The labour-time expended by an advertising specialist, or a contract lawyer is socially necessary provided some capitalist is prepared to buy it.
Conversely, an expenditure of labour-time that might be considered socially necessary under a rational co-operative society, may not be so in a commodity producing society. For example, the former might see the expenditure of labour-time by a surgeon as socially necessary, and yet a commodity producing society might limit how much labour-time is devoted to it, because there is insufficient effective demand for it.
Because Capitalism operates on the basis of producing first, and seeking a market for what has been produced afterwards, the potential for the effective demand being less than what has been produced is always present. In other words, labour-time has been expended that was not needed. It was not socially necessary labour-time.