> Is it okay for the government to enact targeted legislation to punish the exercise of legitimate political speech?
It's not. This may be fresh legal ground, but it could be argued that it's a 1st amendment violation, if the law can be shown to be in retaliation* to speech, even if the law itself complies with the 1st amendment. (Mind that these are distinct questions: Is it OK, and is it legal. And even though I've answered that it's not okay, I still welcome the move. It's less not okay than perpetual copyright.)
But I think accepting that argument would be even more perilous. If the motivation of legislators can be used to overturn otherwise constitutional laws, you're in a big mess. E.g. you could argue that an algorithmic transparency law violates the 1st amendment if it was motivated by Musk's purchase of Twitter.
The other question is, does this set some kind of precedent - not legal, but of political norms. I'm not sure, but quite possibly yes. While there are plenty of examples of government harming or helping various entities depending on how in-favor they are, there may be a difference in kind here.
*Extremely mild retaliation - I would be surprised if more than 1% of Disney's revenue can be attributed to works older than 50 years.
Edit: Apparently the bill is more narrowly drafted than I thought, and would only apply to two companies in total. Laws this narrow supposedly have precedent to being illegal, according to https://news.ycombinator.com/item?id=31334339
But it's an interesting question if to consider what the legal case would be if the law was a general reduction of copyright to ~50 years, for everyone.