I think he probably was making a joke. But it is also the president’s response, and therefore the most important US response, to a fairly important diplomatic incident.
And it comes in the context of his not being able to stand-up to Putin on any issues, while also under suspicion of having colluded with him to get elected.
When you are the president, you have to know when, how, and about what you can joke. This one required a bit of seriousness.