Brexit was a fantastic example of a nation shooting itself full in the face.