Both are right!
I think there's some validity to the idea that the E3 was the predecessor to both the 5- and 7-series, although I also agree that the 5 was also a direct replacement for the Neue Klasse and the 7 replaced the E3. It helps if you look at it in terms of market positioning rather than strictly size, and regard the European E12 5-series as a pretty different animal from the E12 sold in the U.S.
Chronologically speaking, the E12 debuted for the 1972 model year in Europe with four-cylinder power, while the slightly smaller, also four-cylinder NK sedans were discontinued and the six-cylinder E3 line didn't change. The NK had never sold in significant numbers in the U.S., so it wasn't directly replaced here at that time. The 530i that came to the U.S. for 1975, however, was more comprehensively equipped (and expensive) than the typical Euro-market 5-series, with the same fuel-injected six as the full-boat E3 3.0Si, and it directly replaced the Bavaria (but not the E3 line entirely) within BMW's U.S. lineup as the junior four-door model. The 3.0Si continued here through 1976, and was replaced by the E23 733i in 1978. The 7-series was larger than even the long-wheelbase E3 in large part because the more efficient packaging of the E12 5-series made it nearly as spacious as the E3 inside, despite being smaller on the outside.
Part of the problem with people's conception of the E3's place in BMW's history, at least in North America, is the Bavaria name. As Restart alluded to, it's the only BMW with an actual name, which is a lot easier to remember than the usual alphanumeric soup, so to most Americans who even know of the E3, "Bavaria"=any E3, when in fact the Bavaria model occupied a very different niche within the BMW lineup than any of the other, more luxurious E3 variants (except for the very rare 2500).
TL,DR: generally, yes, the 5-series replaced the NK and the 7-series replaced the E3, but in the U.S. the 5-series replaced the Bavaria, while the 7-series replaced the fancier 3.0S/Si.