The bug is in the ASTComplexOptimizer. If you comment out this line in DefaultOptimizers and then run the two versions of the query, you get the same number of results:
Comment out this line in DefaultOptimizers.
It is turning the version of the query with the additional OPTIONAL into a very different query plan involving several named subqueries (bottom-up evaluation), a hash index build, and a merge join. I have not analyzed where the problem is in that query plan, but the two query plans are very different.
Workaround: Disable the ASTComplexOptionalOptimizer.