A wise man once told me, to stop worrying about things that I can't change. There will always be people copy&pasting or even claiming other's ideas as their own. No license will prevent that, and IMO it should not prevent you from publishing if free education or help to others is your intention.
I'm not quite sure the best way to explain this, but I don't agree with this idea. If you shared something with the good intention of teaching others as an example, then the mission was accomplished, but what happens later with the code can still be important to you.
Perhaps you feel very strongly about teaching others, and are strongly against plagiarism as a matter of principle. The fact you shared with people who learned does not negate the fact that someone else took the work as their own, which could be an affront to your lifelong beliefs.
One time, I made an estimate and it ended being way off because I hadn't accounted for the time I would need to create a test jig to properly simulate communications between the target I was designing and the client's existing hardware. That was a whole new chunk of electronics that I had to assemble, program and test. I had to eat a bunch of that time and not charge for it. The customer and I had a lot of long conversations during that project.
I have learned from that oversight. It was not intuitively obvious at the beginning but it had to be done. I know better now.
To guard against this from happening again, I am developing a pseudo generic dev board + PC software that allows me to simulate communication between the target system and the rest of the client's system.
Do I know everything? Nope. Not even close. So, most times, the work demands you to perform research. I will and do charge for that but I let the client know in advance. I consider it as part of the initial project assessment checklist. I classify this as a combination of due diligence, quality control, professionalism and pride of workmanship.
Nobody is perfect but we can be true to our intentions.