An effective feedback loop between cell-cell contact duration and morphogen signaling determines cell fate