CBG was the only option to master submarine construction, MRO upgrades. It is not merely about construction equipment, rig, hall or knowledge. One needs an experienced crew to conduct tests through MRO or monitor the MRO process.
And true second likely option was to remain within same echole with Type 214 - 218, a lot to learn, but at least major - minor equipment and systems would be retained as common.
Lastly, scorpene is a far superior submarine and this comes at a greater price. To operate 10+ scorpenes Indonesia should be operating a navy similar to Japan. However i don't see this viable neither financially or technically in foreseeable future.
Better sell CBGs and add + 2 scorpenes to make per unit price feasible, after all those newly purchased equipment and refurbished - built construction halls, instead of living in a dream of selling scorpene-class submarines in 2040s.