When prodicers started learning about their cancellations in time to produce a finale and also made the amazing discovery that fans of a show liked a wrap-up?
I mean, in ye olde days of the teevee, when it exciting to see the NBC peacocks tail go rainbow colored, shows just stopped. Unless there was a positive decision by the producers to end a series, there was usually no notice until after the season's episodes had aired. Until the internet made it clear that fandom was bigger than Trek, producers seemed to act in a vacuum instead of trying to actively foster viewer engagement beyond buying show-related merchandise.
ETA: The first one I really remember is Mary Tyler Moore. Newhart and M.A.S.H. came later. Did Perry Mason have a series-ending episode?