Your way of thinking definitely isn't entirely incorrect, and I think a lot of times people forget that prices, while they can certainly have an arbitrary component, are largely driven by market forces, which at the very least will tell you something about the supply and demand of a product. However, I disagree with this:
> And all these additional costs likely make it the "wrong" decision since they likely contribute to carbon emissions or otherwise wasteful use of the earth's resources
I think this doesn't often hold true, yes, an efficient market begets economically efficient resource allocation, but there's more to environmentalism than efficient resource allocation. Your example is good, it's certainly more economically efficient to use less petroleum when transporting goods, and that efficiency can be reflected in final costs. But let's look at another example:
Say you're buying lumber to build a house. There's a local lumber farm that sustainably grows and cuts down trees. Since its close, transportation costs (and associated emissions) are low - largely coming from amortized land costs and labor. However there's another company that buys cheap land from farmers in the Amazon, with cheaper labor, ships it up via freight, and sells it for marginally cheaper. The costs in the latter example are largely driven by transportation - and while cheaper, has a significantly larger carbon impact.