Just create an additional consumable item for purchasing additional coins beyond the first 5,000, and consume that one as usual, immediately after it is purchased, recording the 5,000 coin increment yourself, just as is done in the TrivialDrive IAB example.
When the initial purchase of your combined remove ads/Get 5,000 coins item is made, do not consume that item - treat it as non-consumable - but treat the purchase event itself as a one-time trigger for performing the same logic as you would when consuming your "buy additional 5,000 coins" item.
Remember that "consumable" and "non-consumable" items are not different from one another so far as the Google side of this process is concerned. They are consumable or non-consumable only by virtue of the decision made in your code to consume them and record the increments to consumable resources internally, or to leave them there as a permanent record of the fact that the purchase has occurred. Leaving the item there makes it visible on all user devices that support IAB, whereas the consumable items must be recorded (and shared between devices) by other means (e.g., in your app's own database in the cloud).
So, an alternative to the above would be to immediately consume the purchase of the remove ads / add 5,000 coins item, and record that ads are permanently removed, and that the user has 5,000 coins, in your own database. Then, that item could be re-purchased by the user, with the turning off of ads as a redundant no-op, and only the 5,000 coin increment being recorded.
But that second approach would only confuse your users, because the item would still be called "Remove ads/ get 5,000 coins," even after ads had already been removed. Also, the approach I've outlined at the start ofthis answer would allow you to create any number of coin purchase items, with not only 5,000 coins, but other amounts, as well.