I bought a used phone and needed good low light camera for documentation of network closets, so I had to compromise on the wish for a headphone jack. Now I got an adapter that I use at home to use my headphones for calls. On the go I have noise cancelling equipment that uses bluetooth anyway. It would still be more handy to have the jack built in.
Pretty much any smart phone should be able to do this with software, really - it’s all just a factor of ISO (light sensitivity) and exposure time, and pretty much every phone sensor can have an absurdly high ISO.
I don't know enough about the details of dynamic ranges of the sensors etc to dispute the point that they should all be able to do that. You could be right for all I know.
I agree that the software seems to play a big part. And it looks to me like Google is still offering the best camera software on Android, so I ended up buying a used Pixel 6 in the end. With the additional hope of it being open and popular enough that I'll enjoy many years of Lineage OS or similar once official support stops.
You can download an app that lets you manually control the phone camera - see if you can download one and have a play around with it, pump up the ISO and the shutter speed. If you can hold your phone steady you can take a photo of an almost completely dark room that looks almost like you took it in the daytime.