.....it would appear that the Republic of Ireland (not the UK) is responsible under EU law for the setting up of a hard border with its non-EU neighbour, Northern Ireland. Just as Spain had to do with Ceuta in Morocco.
https://en.wikipedia.org/wiki/Ceuta_border_fence
A 310 mile border would cost a helluva lot to build and to cover with security. No wonder the EU has used the breakdown of the "peace process" as a threat.
Fun & games!