It might have to do with how the phone was tilted right before you lay it on the flat surface. So in other words, if it was tilted to one side as you were placing it on the surface, the phone's internal sensors might have shifted to landscape (which wouldn't be noticeable on the stock Google Now launcher). When you finished laying it flat on the surface, the flat orientation wouldn't tell the sensors that you want to be back in portrait mode--the phone just thinks it should still be in landscape. So when you launch an app that auto-rotates, it launches in landscape.
I just tested it out on my 6P, and that is in fact the behavior. If I place the phone right edge first on a table, then lay it flat, YouTube will then launch in landscape. But if I place the phone bottom edge first on a table, then YouTube will launch in portrait. The best solution is to be aware of how you're holding the phone when you place it on a surface. Make a habit of placing it bottom edge first.