There are a few things to consider. First, with flash photography of any kind, the camera flash is entirely separate from the shutter speed. It doesn't matter when in the exposure the flash fires, the result will be the same so long as it fires during the exposure (and your subject isn't moving). The only camera settings that affect flash exposure are ISO (sensor sensitivity) and aperture (fixed at F2.0 on the 6P). The shutter speed controls how much ambient light gets let into the exposure in addition to the flash. The more you want the background to be bright, the longer the shutter will have to stay open (or the higher the ISO or wider the aperture if it wasn't fixed), and it may be too long to avoid a blurry pick. Also keep in mind you're taking pictures in pretty well the most difficult scenarios for any camera to get a decent picture in (Low light, high contrast).
The other thing you need to understand is exactly how the camera exposure meter is working, and I think this is more where your frustrations are stemming from. On the 6P, it spot meters wherever you tap the screen, which means it's only looking at a very small portion of the screen (eg. someone's face). This is ideal for many scenarios, but not all. In your flash example, look at what I assume is sour cream, is perfectly exposed. It is very bright compared to the rest of the image, so in order for your camera to avoid blowing the highlights on the sour cream, it picks an exposure for the sour cream. The camera may have decided to meter off the sour cream itself, or maybe you tapped the screen to focus and used that as your metering point. Since everything else is much darker than the sour cream, it will of course appear underexposed in comparison. If you wanted to have everything else in the image very bright, the sour cream would be totally blown out and very much over exposed, because a camera can only expose for one scenario. HDR+ will mitigate this somewhat, as it takes 3 images and lowers highlights while raising shadows, to closer simulate the high dynamic range that our eyeballs see. Your camera screen gives you a live preview for exposure, so you can tap around the screen and see how it exposes differently on different spots. If you tap on a dark area, it will try expose for the dark area, and everything else will be super bright. If you tap on a light area, it will expose for that bright area, and everything else will appear darker because it's going to get underexposed.
"Regular" cameras do the exact same thing. For example, if you take a picture with a bright sky and a dark foreground with even a $7,000 DSLR, you can only pick one to be properly exposed. Either the sky will be exposed and the foreground will be very dark, or the foreground will be exposed properly and the sky will be totally blown out. Also anytime you have a lot of white (or chrome or anything bright) in the image, for example a dinner plate, that often tricks the camera meter into thinking the image is brighter than it is, because it's trying to pick one exposure to average over the entire scene and give you the best possible overall exposure - it can't do that properly for a high dynamic range scene (very bright and very dark things in the same image).
In your second image of the pill bottle, what is happening with the flash, is you're asking the camera to expose something very bright compared to the background, and use flash to do it. It doesn't need to raise the ISO or use a long shutter speed, because it's going to get a flash for a light source (and the bottle is white), so instead you get a faster shutter speed and/or a lower ISO, which kills background light very quickly, which is why the background is so dark. It's also going to use a very weak flash, because the distance of the bottle to the camera is very small, further reducing background illumination. It is behaving exactly as one would expect given the scenario.
The flash on my 6P works exactly how it should be given the settings. It's also a camera phone, so the flash has **** for range, like every other phone I have ever used. If you don't like the settings it chooses for the particular work you do (eg. the car parts), grab a different camera app like Manual Camera or Pro Shot and force certain manual settings along with the flash to get the result you're after. The principals of photo exposure remain the same, so in my opinion you are getting frustrated by A) Asking the camera to give you an unrealistic exposure for the given subject matter, and B) the settings it uses by default for flash.