Indeed, the horizontal black-white-red flag was first widely used in the North German Confederation (post-1866) and subsequently as a flag of the (second) German Empire 1871–1918. In addition to the plain tricolor, a number of other flags based on it or using it in part were used for various other uses such by the army or at sea.
In 1919, after the November Revolution of 1918 and the first democratic consitution, the new state (typically termed Weimar Republic) adopted the older black-red-gold tricolor as its national flag that had already featured prominently in the (ultimately unsuccessful) revolutions of 1848 as a reunification flag – while the merchant flag at sea as well as various other secondary flags retained an overall black-white-red design. There are probably many reasons why the Confederation of 1866 and the Empire of 1871 decided against using the older reunification flag, among them the absence of the colour gold (which would symbolise Austria), the similarity to the flags of Prussia and Brandenburg and the fact that the 1871 state was supposed to be top-down, not bottum-up.
Glossing over the history of the Weimar Republic it should nontheless be mentioned that many far-right reactionary groups – including the Nazis – considered it a treacherous state that should never have been founded and they proudly showed the ‘real’ German colours (black-white-red) to symbolise that they stood for the ‘true’ German state. (Some have argued that the merchant flag remaining black-white-red be, in itself, appeasement to reactionaries. However, others point to a desire for continuity and recognisability at sea.) It thus shouldn’t come as too much of a surprise that one of the first changes made in 1933 after the Nazis came to power was to replace the hated black-red-gold with the old black-white-red – alongside the Nazi flag (which also features the colours black, white and red in that order). After 1935, this dual practice ended and the Nazi flag became the sole official German flag.
After the war, both German states decided to go back to the black-red-gold standard; both as a means of distancing themselves from the Nazi regime but also to symbolise the early reunification efforts plus an effort to continue (but successfully) the democracy of the Weimar Republic.
Furthermore, it is illegal to display the symbols and emblems of organisations that have been banned for aiming to disband the constitutional, liberal, democratic state (§86 and §86a StGB (German criminal code), also includes the symbols of ‘replacement organisations’ and these organisations’ propaganda); this obviously includes Nazi insignia such as the Nazi flag. So even if they wanted to, displaying a Nazi flag in public will get you arrested far before you even get to the demonstration where you are trying to make your point.
This last paragraph especially is the reason why far-right protesters often fly black-white-red: it is not illegal to display it (as it is not directly connected the the Nazi party or any of its successors) but it is the closest legal option – especially since it was a co-official national flag between 1933 and 1935.
This is the dark past that Scholz is referring to: the Nazi dictatorship not the preceding Empire of 1871. That is also why it is usually used as a symbol to reject the current democratic order and why it attracts far-rightists.
As for unifying Germany: in current understanding, the revolutions of 1848 are the real unifying events even though they were unsuccessful. In addition, the events of 1848 were democratic and popular (i.e. people-driven) as opposed to the aristocratic nature of the 1866/1871 events. Flying the black-white-red flag is not seen as a symbol of unifying Germany in any way – and that’s notwithstanding the fact that there is currently nothing to unify as Germany is already a unified federal republic.
In addition to all the above, there are a couple of fringe conspiracies that play in. First, a small minority of royalists does indeed want a monarchy back, but that is more of a side thought.
More importantly, there is an increasing movement of ‘Reich citizens’ (Reichsbürger), that claim that the current German state is illegitimate (usually they believe it to be a corporation) due to either of the German Reichs continuing to exist. Some say this is the Third Reich of 1933–1945, some go even further and say that the Empire of 1871–1918 never ended. These movements are considered a danger to the democratic state (because they obviously believe it doesn’t exist and thus want to reinstate the ‘real’ state, effectively overthrowing the current one). This adds to the problematic meaning of the black-white-red flag.