Your architecture is sound.
The root of the problem here is that... well... you haven't actually defined a domain model. In many ways your question can be rephrased into something like, "How can I make sure developers write the correct code?". Well... you can't.
What I am seeing here is the tension created by using a data model (EF) as a domain model. You ...
This is simply a bug and we need to see how to fix it and avoid it in the future. But let's see if there is a compiler time coupling problem
I mostly agree with @flater's answer. I am starting it in a different language to provide a different view
In your design order and order lines are entities. Order is also the aggregate. So in domain driven design ...
First of all
A relevant answer of mine I think you should read.
Your question is based on your interpretation on the fundamentals of repositories with EF, and that interpretation is not complete (that's not to say mine is provably complete either). This leads to the issues you're uncovering.
However, it requires you to change your interpretation, rather ...