The estimates of the per-unit costs of the original bids seem widely off. They refer to off-the-shelf submarines delivered to other navies, not any of the options Australia had on the table when they awarded the contract. There are at least three factors that can account for the cost difference between those and what Australia was loooking for: design changes (to accommodate special requirements regarding the combat and weapon system, autonomy, discretion, etc.), local workcontent, and technology transfer.
For example, this article from 2016 provides a contemporary view of what happened during the last phase of the bidding. Importantly, it doesn't suggest the price was that different. Japan was hoping for a $40B deal, even before factoring the local work aspect. That's in the same order of magnitude than the last projected cost of the programme that was called off and very similar to the original DCNS bid.
Earlier in the process, there were people in Australia who recommended selecting an off-the-shelf design, whether from Japan, Germany, or Sweden (who made Australia's current Collins-class submarines) and that would perhaps have avoided all these problems. This 2021 article also mentions German-designed submarines as costing “half as much”. That's a significant difference but not as big as that betweeen off-the-shelf options like the Type 212 or Type 214, on the one hand, mentioned in your question and a bespoke design like the Type 216 (and that doesn't take into account predictable cost overruns, especially if built locally).
On the other hand, if you add specific requirements and want the submarines to be built locally, costs are going to be much higher and more difficult to control. That was true of the 2015 bids and will in fact almost certainly be true of the solution Australia is exploring now.