Welcome to Microsoft Q&A!
The code you are using to minimize the UWP app, it actually suspends the UWP app so that the app will be minimized. It affects the whole app and that's why all views are minimized.
>>Can I minimize only the main view in UWP?
Currently, I'm sorry to say that there is no such way to minimize only one view of the UWP app. You could submit a feature request in the Feedback Hub about it. The Feedback Hub could be found in the Start Menu.