Similarly I used to think cows just produced milk for us naturally and we had to milk them or they'd explode when I was a kid. Boy was I in for a shock when I realised what mammals are and that cows need to be pregnant to lactate like any other
Mammals don't need to be pregnant to lactate or, at least, they need to have been pregnant, but, after that, as long as they keep being "milked" they'll continue to lactate. I know you weren't necessarily saying otherwise, but just for clarity.
I used to work with a guy who genuinely thought all dairy cows were forcibly kept permanently pregnant in order to produce milk.
Mammals often lactate less and less as time passes, for many of them lactation stops even if you continue milking, which is why cows in farms are perpetually impregnated (which is horrific)
There is a difference between permanently and repeatedly. Also between being pregnant and having a calf. People muddle these now and then, purposefully or not.