I want to start by saying that these discrepancies were not detected when the bills were being written. Otherwise, they would have been avoided.
As for how we are made aware of them, it is part of a process: statutes are constantly being examined to see if they are still up to date or if they need to be modified. Perhaps the government wants to move ahead with other legislation. We are always looking at the existing statutes. During that process, there are times when we, or the departments responsible for enforcing the legislation, notice errors.
You asked if these discrepancies are pointed out to us following court rulings. I need to be careful here. If this were the result of a legal decision, or part of one, it is reasonable to think that it could spark some debate. In such cases, it would not meet the criteria of being non-controversial.
Basically, these proposals are the result of re-reading statutes, as written by the federal public service. The nature of our work is such that we are constantly studying statutes.