This change takes the configured "maximum page size in memory" into account, rather than a fixed multiple of the on-disk size.

Taking the defaults (cache size 100MB, internal page size 4KB, maximum in-memory size 5MB), previously we would have deepened the tree when a page reached 10K keys if the keys were 40 bytes each, or 20K keys of 20 bytes each.  With this change (still using the defaults), the memory page maximum would only come into play for keys larger than 500 bytes.

We could certainly build a multiple of the on-disk size back into the second test, but we can't safely let pages grow larger than the configured maximum page size in memory, as shown by the simple example that hangs with a 1MB root page in a 1MB cache.