Prior to McCain-Feingold, it was already illegal for corporations to directly advocate for or against candidates in elections - but it was defined using “magic words” - the ads couldn’t say “support”, or “vote for” or “vote against”, etc - but they could make ads saying things like “Call Candidate X and tell them to vote against this bill…” or something like that.
The point of Section II of McCain-Feingold was to close the sham Issue advocacy loophole. As I said before, CU overturned parts of both McCain-Feingold and FECA, which was the prior existing law.
Prior to CU, there had been only one SCOTUS case that addressed the question of whether corporations had first amendment rights at all.
The story of Roberts and Citizen’s United is actually somewhat interesting. The question initially presented to the court was simple - could Citizen’s United air a film critical of Hillary Clinton within the previously defined time period?
The vote was 5-4, and Roberts wrote the opinion, saying yes to only that narrow question. Kennedy wrote a concurrence suggesting the final, much wider ruling, which was taken up by the majority, with Roberts retroactively taking up this wider question presented sua sponte.
Souter announced his resignation while writing the dissent, and aired a lot of the court’s dirty laundry in it - he essentially suggested that Roberts manipulated the court’s process to create such a wide precedent.