In days gone by it would have been far harder to impose a general lockdown. How would you have done it? Send a town crier from town to town to announce it? See any issues there?
Travel is also far different to what it used to be. We can leap on a train/a plane and be anywhere in the world in hours now, meaning it can travel far further much quicker.
So I don't think you could say it hasn't happened in the past, there is no reason to do it. You have to respond to emergencies according to current situations not just how people did it in the past. That would be like insisting you exit during a fire alarm down the fire escape despite seeing flames at the bottom because that's how you got out last time.
But it has happened. Maybe not in the whole world style way it did with Covid, but, as I said, that's because travel is far different now.
Spanish flu had restrictions: Coronavirus: How they tried to curb Spanish flu pandemic in 1918 - BBC News
You also have to play into the Spanish Flu that it was at the end of a long and tiring war, so things were quite different in many ways.
There's an interesting article in the National geographic, unfortunately behind a paywall now showing the effects that timing of lockdowns had on different states in America.
And for the Black Death, did you ever read "Parcel of Patterns" about the village Eyam in Derbyshire who self imposed a lockdown on themselves, initially to try and keep the infection out, but then when they had it (brought in on the parcel of patterns), to stop it spreading. It's based on a true story. I'd be very surprised if they were the only ones.
And in this country, children who were ill with certain diseases (like measles) were quarantined-they were often taken away from their parents to be nursed in a special hospital, ordered, not their choice, and anyone who had been in contact with them had to quarantine too. Read "The Family from One End Street", the story where the little sister has the measles.
Even in the 80s I remember a local boarding school quarantining, and one local family whose child was taken seriously ill (and I have no idea what it was) having to quarantine in their own house (so they couldn't visit their child) with tape across the garden gate and a warning. Everything the child had touched had to be taken away to be burnt. I must ask dm if she knew what it was that the child was ill with (they did recover) because it had quite an impact on me at the time. This was in the 80s.