Refactor btree insertion. Commonality analysis.

Both for phased locking and regular insertion of btree index tuples, there is a
need to search the tree using a scankey to find an appropriate page, and then
to escalate to a write lock. So spin this off into a dedicated routine that is
called in two different places.