The exact same thing happens in C++—when you're not using LTO, you can pass multiple source files to the compiler at a time to allow these files to be optimized together, but keeping them separated at a file-level prevents optimizations such as inlining functions between them.
Compiling with and without optimizations is another example of that choice.
Compiling with and without optimizations is another example of that choice.