A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
Dear Alex,
Good day!!
I understand your concern and to my knowledge, there is no out of the box feature or setting in the SharePoint Online List or Library to meet your requirement.
I agree with you on having the ability to sort the column initially then allow folders to be the primary sorting field afterwards in the SharePoint Online will benefit the users and I suggest you to add your valuable idea as feedback in the SharePoint · Community (microsoft.com) which is the best place to share our ideas and improve the Microsoft products.
Appreciate your patience and understanding. Have a great day!!
Best Regards,
Sophia