I think three years is probably not optimal because you don't really want to just lose him, Trout or no Trout. I also think the more likely outcome of any opt-out that soon is the Phillies are forced to renegotiate, not walk away. But I also don't mind them giving it to him if that's what gets it done.
If baseball continues in the direction it is going he might not find the open market to be that appealing in 2021 anyway (because even if the players gain a lot of ground in the next CBA it won't be tilted towards older free agents). OTOH if the NL adds the DH he could take advantage of that and it would be bad for the Phillies to lose him (Hoskins and Harper a perfect tandem to share the two positions at that point. Anybody thinking Ortiz is knocking on that door right now?)
History also says every player is tradeable, no matter how untradeable they seem. Vernon Wells, Matt Kemp. The Red Sox guys. And in Harper's case he's likely to still be a really good player in years 4-6, and beyond if there's a DH.
Anyway, right now this situation seems to resemble Arrieta more than anything else. There might not be a serious discount but there sure doesn't seem to be any serious second bidder.