Since this hasn't moved yet as of beta3, I dug in. PostGIS is focused on getting PG17 well supported in their 3.5 release, currently in alpha testing, and that's probably why this rough edge has lingered around 3.4 for so long.
On the error log there's a pair of basic compiler issues and then a few regression tests are failing. Paul Ramsey dug in for me and has fixed the compiler problem:
We're not 100% sure that will fix all the regression issues, but all seems solved in his local build. He tells me it's not unusual for those particular tests to require per-version tweaks if there's still something off. I gave up on trying to build everything myself to check when I realized postgis_3.4.2+dfsg-1.pgdg+2.dsc doesn't even have PG17 listed yet.
If it takes a full release of the upstream 3.4 PostGIS branch to replace the sid 3.4.2 that's not building, we can ask Paul R to lean on speeding up the next point rel. I can't tell if that's the easiest way to navigate this through the Debian stable process, or if this is going to be a PGDG source change no matter. Baton passed to you!