Is it bad to apply to one PhD program with the intent of leaving for another (more prestigious) one?
This would be wrong.

The reason the PhD is subsidized, while the master's is not, is because you are making a longer-term commitment to the university, and they expect to benefit as an institution from your PhD work.  You would be accepting this under false pretenses.  In my opinion, this is just wrong, apart from whether it harms you or not.  You should not enter into agreements where you never intend to hold up your side of the deal.

It would also not work as well for your plan.

I think it will be hard to produce evidence, based on 6 months or a year of a PhD program, of your improved academic performance.  But you could actually complete a master's degree in a year's time, and that would be something that would really help admission into a PhD program.

Leaving shortly into your PhD program is definitely frowned upon.

Universities actively try to stop this from happening.  For example, they usually do not allow people in PhD programs to convert their work into a master's degree after a year or two of study, precisely because people would try to take advantage of this loophole to get a free master's.

This will look bad to the institution you are leaving.  I'm less certain about how the institution you are going to would view it, but it seems a potential negative there, as well.