A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
Hello Ioannis,
Per the description shared, I understand your scenario and I would like to let you know that even in SharePoint Online, we can only share a specific folder with a group, where the group can only see the content of the shared folder.
For example, we can create one document library on the SharePoint Online site and create multiple folders, then shared each folder with the group created based on our requirement.
In detail, if you create one SharePoint Online site called SIte A, it will have a default Shared Document Library; if a Document Library contains multiple folders like Folder 1, Folder 2, Folder 3, Folder 4, Folder 5, etc., you can share Folder 1 to Group A, Folder 2 to Group B, Folder 3 to Group C, etc.
After sharing, members in the group can only access the folders and contents in the folder shared with them. However, the members added to the SharePoint Online site will access everything on the site.
If there is any misunderstanding or any further discussion, please feel free to post back, I will try my best to share my opinion.
Appreciate your understanding!!
Best Regards,
Chitrahaas