The Foundation Predicate is available in the open source Foundation. I think it requires iOS 17+ because it uses variadic generics. But that's not actually necessary for the SwiftData APIs which only pass in a single model type.
This should probably go into an own package.