I will be travelling soon to the US from Jakarta. I have both US and Indonesian passports. Indonesia does not recognize dual citizenship, yet the US requires me to enter and exit the US with my US passport. My flight have 4 hour stop at Taipei, so can I exit the immigration and enter using Indonesia passport while in Taipei? then enter Indonesia using Indonesian passport?
...the US requires me to enter and exit the US with my US passport.
Actually, it only requires you to "bear" the passport. When you leave the US, you do not show any passport to any government officer. You can check in for international flights from the US with your foreign passport, at least with some airlines; I've done it dozens of times and never had a problem. Because you will have your US passport with you when you leave, you will not be violating the law.
As to the flight to the US, you will need to show your US passport when you check in, because otherwise the airline won't let you board, because you do not have a US visa in your Indonesian passport. You cannot get a US visa in your Indonesian passport because you are a US citizen.
You might be able to convince the airline to check you in with the Indonesian passport and let you use the US passport as a secondary document to prove your ability to enter the US, but there is still a chance that your US citizenship would be disclosed to the Indonesian government.
To be safer from that possibility, you can book two round-trip tickets, one between Jakarta and Taipei, the other between Taipei and the US. Use only your Indonesian passport for the former, and use both passports for the latter.
You use both passports for the latter because you do not want to enter Taiwan with one passport and leave it with a different one. If you try to do that, you will have problems on leaving Taiwan because there will be no record of your having entered, because you used a different passport.
In any event, entering and leaving Taiwan with your Indonesian passport is unlikely to help anything. The Indonesian government's most likely source of information about you is the airline's passenger manifest, not the Taiwanese immigration authorities.