To be more specific, such structure would not be illegal, but you would have to deal with double the amount of bureaucracy and you would pay the same taxes.
How would you expect this to be remotely legal ?
Sure, there are plenty of people doing that, just as there are companies registered in the Cayman or Gibraltar, or people having secret Swiss bank accounts.
The company is a separate legal entity.
The company pays corporation tax in the country where the company is registered, you pay income tax in the country you live, and then there is also vat.
If you pay taxes (in Italy, say) on the income from your company, wherever it happens to be.
I get the impression that it's all something of a legal gray area. It'd be a lot simpler if people could easily have companies in their own countries.
I'm all for paying one's fair share of taxes on income in the country you live in. What I intensely dislike about the laws in Italy surrounding companies is that there are all kinds of expenses that have to be paid even if you are losing money.
Its mainly about which country's employment laws apply.