Here is a related issue on GitHub, ILLINK errors when compiling MAUI apps on Mac - says targeting version that I'm not.
@jaysidri share a workaround pinning the workload version did the trick and you may have a try.
However we still recommend use the latest Visual Studio2022 (Visual Studio for Mac retire) and .NET SDK and upgrade XCode as the error message said.
For more info, you may also refer to .NET SDK workload sets.