This was the point of their plan to introduce CSAM detection on-device. Unfortunately the reaction to that was histrionic and couldn't see the writing on the wall.
Governments will eventually pass legislation targeting E2E and CSAM was the one issue where Apple's method would have defanged support for that kind of law. But one good thing about making those plans public is that any proposed legislation will likely land on Apple's method as being a good compromise. Better for Apple to wait until they're forced by governments to do it.