It's not so surprising.
Trump obviously doesn't understand the importance of the public sense of the courts seeming to be fair and independent.
Roberts wanted to make the point that they are.
In the end, Roberts may need to make determinations about the actions of the president. Their validity will depend upon the public's understanding that the Supreme Court is a fair arbiter.
Trump, of course, is trying to undermine the rule of law generally, so they are on a collision course.