It's impossible to know for certain, but perhaps having invested so much in nuclear weapons and finding that it only made the US more belligerent, they realized that they had to shift their strategy? Or maybe they've been waiting for the opportune moment to extend the olive branch? Become a nuclear power so that they could negotiate from a position of power and get better terms?
It's not that complicated. To get the best concessions you come with biggest chips of your own to trade. Even if NK's intention was to negotiate from day one, they would have gone for nuclear weapons first, given that prior negotiations did not net them satisfactory concessions. What's changed is that they believe they have big enough chips now and Trump is high-variance enough that the gamble is worth it.