I'm also Polish, I know quite a few people in IT who used to do exactly that, but this year they all had to stop or figure out some workarounds, because the Polish tax office has started asking for proof that their company is actually working with more than one client. If they only have a single client in a year then they have to convert to full time employment. So yes, people are absolutely getting caught by this.
most of the countries now have something like that but for sole proprietship. if you have an llc, you can do basically whatever you want because it is taxed different, and somebody has to be employed there, so the country gets the taxes. its just that you can pay yourself some salary and the rest you can pay out at the end of the year as profit that is taxes different.