We see this a lot in elementary school. The younger kids use the words because someone has an older sibling who has said it or nowadays you hear all sorts of things from the tv and radio.
I can't speak to raising kids. I have a nine year age gap with my brothers, but my kid is 3. Long post of stuff you probably already do. I just haven't finished my coffee enough to be concise haha
As a teacher (elementary, ages 5-11), I do exactly what you do. Children have to be taught expectations. So you have to decide what your expectations are. Can they swear at home when they aren't talking to you? Can they swear when talking to you? Can they swear with their friends? Can they swear out and about? Can they swear at school? It sounds excessive, but you need to define if and when it is okay to swear and make sure they know. But once you've set those boundaries, you also have to know how many reminders are too many. If they slip up, that's one thing. If it's intentional, that's something where there needs to be a negative consequence. They should be logical so preferably social based: write a letter to that person, have a reflective conversation with an adult, ending the conversation (usually intentional swearing is attention getting)...
I grew up around adults who swore up a storm. My mom was always very clear about the boundaries. Adults at home with family, they can swear. Children, don't swear. Teenagers, can swear with friends but not in the presence of adults or at school. Grown children should mind their words around parents and def not swear in front of kids and anyone who swears at the host can gtfo/general rule that you cannot swear AT someone. I have a sailor's mouth, but I've never been in trouble at home or at school for swearing because I knew exactly what the expectations were from a very young age and why. She explained that it is a matter of respect/politeness and how the words we use matter and the social context matters. And I tell my students that. They way I talk to them is different from the way I talk to my boss which is different to the way that I talk to my friends. I even go so far as to tell them that everything I do changes. When I get close to school, I change the type of music I listen to in my car. I dress differently at school than I do when I stay home all day. I try to find something they do to highlight that social context piece.