We can't answer why question here as this is a user to user only forum. We don't work for Apple, nor did we design any of the features inside iOS. Suffice to say, if the camera is open, your iPhone screen won't auto lock as Apple chose to do it this way. Maybe because Apple thinks if you took the time to open the camera, you're there to maybe actually use it and you could be waiting for the perfect moment to take a photo, where locking the screen would ruin that opportunity? There are a number of things which when open, the screen won't auto lock. Some games for example. Streaming videos would be another example.
If you'd like to let Apple know your thoughts, feel free to use this link --> Feedback - iPhone - Apple