#if !hasFeature(xxx) doesn't seem to work in Package.swift manifest

I have this code added to the end of a Package.swift manifest to enable future Swift features.

for target in package.targets {
    var swiftSettings = target.swiftSettings ?? []
    
    // swift 6
    #if !hasFeature(ConciseMagicFile)
    swiftSettings.append(.enableUpcomingFeature("ConciseMagicFile"))
    #endif

    #if !hasFeature(ForwardTrailingClosures)
    swiftSettings.append(.enableUpcomingFeature("ForwardTrailingClosures"))
    #endif

    #if !hasFeature(StrictConcurrency)
    swiftSettings.append(.enableUpcomingFeature("StrictConcurrency"))
    swiftSettings.append(.enableExperimentalFeature("StrictConcurrency"))
    #endif

    #if !hasFeature(BareSlashRegexLiterals)
    swiftSettings.append(.enableUpcomingFeature("BareSlashRegexLiterals"))
    #endif

    #if !hasFeature(ImplicitOpenExistentials)
    swiftSettings.append(.enableUpcomingFeature("ImplicitOpenExistentials"))
    #endif

    #if !hasFeature(ImportObjcForwardDeclarations)
    swiftSettings.append(.enableUpcomingFeature("ImportObjcForwardDeclarations"))
    #endif

    #if !hasFeature(DisableOutwardActorInference)
    swiftSettings.append(.enableUpcomingFeature("DisableOutwardActorInference"))
    #endif
    
    #if !hasFeature(IsolatedDefaultValues)
    swiftSettings.append(.enableUpcomingFeature("IsolatedDefaultValues"))
    #endif
    
    #if !hasFeature(GlobalConcurrency)
    swiftSettings.append(.enableUpcomingFeature("GlobalConcurrency"))
    #endif

    // swift 7
    #if !hasFeature(ExistentialAny)
    swiftSettings.append(.enableUpcomingFeature("ExistentialAny"))
    #endif

    #if !hasFeature(InternalImportsByDefault)
    swiftSettings.append(.enableUpcomingFeature("InternalImportsByDefault"))
    #endif
    
    target.swiftSettings = swiftSettings
}

Wishful thinking was that by using #if !hasFeature(xxx) would guard against the error when trying to enable a feature that is default implementation in a future version of Swift. What actually happens (e.g. using Swift 6) hasFeature(xxx) doesn't seem to do anything and the setting is enabled and then an error occurs when building the package stating the feature is already enabled. Switching to use #if swift(<6) also doesn't seem to work either.

Curiously when I add a versioned manifest (e.g. Package@swift-5.10.swift) then the #if !hasFeature(xxx) seems to work and any code that wouldn't be compiled has the dimmed appearance.

Is there something about how Package.swift is used that I'm not understanding in order to get hasFeature(xx) to work?

Also curious what the reason is for having the compiler error when trying to enable a feature that is already enabled by default? I feel a warning would be sufficient and also a solution in this case.