It’s actually way older. It appeared first as official flag in 1867 for the north German federation, was adopted in 1871 to be the flag of the German Empire and was no longer in official use in1919 (albeit nationalist groups kept using it).
After that, you’re right.
More Info here: en.m.wikipedia.org/…/Flag_of_the_German_Empire