This happens because the system acts like a mirror to avoid confusing the user's brain. However, after the photo is taken, it is saved in the library in the real position. But those who are bothered by this can choose to leave the final photo inverted.