If the target permanent is an illegal target when Bahamut's third chapter ability tries to resolve, it won't resolve and none of its effects will happen. You won't exile Bahamut and return it to the battlefield front face up. Instead, when the ability leaves the stack without resolving and state-based actions are checked, Bahamut will be sacrificed due to having a number of lore counters greater than or equal to its final chapter number.