Indra is not the name of a person, its the name of a post, same with all other Lords and Gods.
Same is with Trishanku, who is considered as a future candidate for Indra padavi, Hanuma is awarded as a future Brahma for his countless Rama Nama Japam.
The person holding Indra's post will be changed after his term is completed. Until then he can do whatever he wants to. If he does anything bad, he will be punished but his post will not be taken back. But can challenge him in battle and conquer his post.
- Consider the case of Ahalya, he got a Shrapa (curse) and all trees in the world shared that Shrapa and released Indra from it.
- In Govardhana Parvat incident, Lord Krishna also gave him a Shrapa that no one in this world will worship Indra separately (but he should be given share in all Yagnas/Yagas)
- Always in doubt for his throne, Yes thats the fear of his position, whoever is eligible for that post can claim it. Or need to wait until his turn completes.
- He struck Hanumans jaw during his childhood, this is what the actual job of Indra's post is, whoever person he is. Indra needs to maintain balance and peace all over in his territory. So he arrived there to protect Surya deva by listening to the complaint of Rahu, but unknowingly hurted Hanumana.