I think you’re oversimplifying it and, dare I say, exuding a further air of head in the sand politics.
I’m sure you’re aware that Brexit will require deletion of references to the EU within the 1998 Good Friday Agreement, Northern Ireland’s peace deal and, in turn, provides mechanisms for the financing of the peace process by the EU. there seems to be no wiggle room for a legal challenge to this. Unless you know different?
Any bilateral one-off deal between the UK and Irish governments to maintain the Customs Union between the two states would require EU approval. Failure to agree such a deal would impact significantly upon Northern Ireland as a site of tariff checks, something which NI are, I believe, vehemently opposed to.
You are correct, the Secretary of State can stage a referendum within Northern Ireland if it appears a united Ireland is what is wanted. But there is only the possibility of a poll every seven years under the Agreement.