This is squarely in the NUC/SFF/1l-pc territory, and there is plenty of competition here from Beelink and Minisforum.
I just found the Beelink SER7 going for $509, and it has an 8-core/16-thread Ryzen 7 CPU, 32GB DDR4. The 8845 in the beelink is very competitive[1] with M4 (beaten, but not "easily"), and also supports memory upgrades of up to 256GB.
1. https://nanoreview.net/en/cpu-compare/apple-m4-vs-amd-ryzen-...