There is an EU Commissioner for Home Affairs. It's literally their job title.
(As an aside, a territory can secede from a nation and this is not the distinction between home and foreign affairs.)
You are all over the place here. The EU commissioner for Home Affair is in relation to the EU and non EU countries. And I'm telling you that for EU member states, the EU is a foreign affair topic, in fact it's under the umbrella of Foreign affairs ministries. It's not even debatable.
The trouble is the EU treaties are basically not fit for purpose, so the EU Court of Justice sometimes has to make rulings which flagrantly stretch the intent of the law beyond any sensible reading of the text. We saw it earlier this year when the German Federal Constitutional Court basically said the EU Court of Justice was making indefensible rulings when it came to the ECB's mandate.
You described jurisprudence which is a large source of Law, everywhere.