Scotland and NI quit UK to form their own republic and rejoin EU together. Everyone happy. Maybe even republic of Scotland-Ireland.
You don't know anything about Northern Ireland I see.
EU countries that have issues with independence movements (e.g. Spain w.r.t Catalonia) will not let automatic re-join, because the "You will be out of EU if you secede" is one of the arguments used for saying that secession is a bad move.
Imagine a hard border on Scotland.
Don't think the monarchy would approve of that much.
Meanwhile, everyone has forgotten the UK's land border with Spain at Gibraltar...