Magento 2 missing setup folder

While working in a local dev environment using Docker, I’ve had Magento 2 missing setup folder from time to time, on environments using Warden or SwiftOtter/Den. Also found reports that it happens using ddev. The most common situation is when switching between branches having different magento2 versions, therefore having different magento2-base module versions. This is…