I’ve been watching Moonlighting – the groundbreaking “dramedy” from the 80s – and I feel like it was the first post-modern TV show, specifically in how it was self-aware and broke the fourth wall.
Consider the finale of season 2. At the end, David and Maddie are being chased by the bad guy. They literally run off the shooting set (a hair salon) and into the backlot of the TV studio, as someone on the crew says, “Wait, we have two more minutes of dialog on this set!” A chase ensues through the studio property until they run back onto the Blue Moon office set.
The bad guy is holding them at gunpoint when suddenly a crew member grabs his gun and says he has to get it back to the prop department, as other crew members start to break down the set around them. The actor playing the bad guy complains that he doesn’t know what happens to his character, so David explains to him how his character’s life ends up.
David and Maddie then walk off the now-empty set again, into the parking lot. They have a discussion, still referring to each other as “David” and “Maddie,” even though they should logically be Bruce and Cybill at this point. Then they get into their – presumably personal – cars and drive away, ending the season.