Update: I was finally able to solve this issue! The solution in this post helped me:
Packaging error ‘detected compiler newer than visual studio 2022’ - beginner - Development / Programming & Scripting - Epic Developer Community Forums