I don't get the unethical part. Any player knows he may be traded at any time, unless there's a a no-trade clause. I'm sure JD has heard the rumors of trade, if he opts in. He can select some no trade teams, so he negotiated this back then, knowing trades are part of the game.
BTW, if he gets traded, it will be to a team that is spending and looking to win, so it's not like he's going to the Marlins.