Avoided level-crossing, correlation and entanglement of two-component Bose–Einstein condensates in a double well