Dynamic “home” image and URL based on current folder

You might want to consider setting things up as a subfolder-based MultiSite. You would then have www.example.com as the top-level site, with www.example.com/brand1 and www.example.com/brand2 subsites where you would be able to set separate logos and navigation.

If separate navigation isn’t your goal, i.e. you want it to be easier for people to move between brands, you might instead want to set up a custom post type for each brand. So, you could set up a brand1 CPT where the archive is www.example.com/brand1 and all individual brand pages are in www.example.com/brand1/post-slug and you could then add a conditional in the theme header to swap out the logo if it’s that post type.