Functional `ref` prop throws a `Maximum update depth exceeded` error when suspending.

React version: `18.0.0-alpha-464f27572-20210713`

## Steps To Reproduce

1. Click on the `suspend` button: https://codesandbox.io/s/ref-set-too-many-times-jm0c3?file=/src/App.js.

## The current behavior

Clicking on the `suspend` button throws a `Maximum update depth exceeded` error.

## The expected behavior

Clicking on the `suspend` button suspends.
*
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */
import {enableCreateEventHandleAPI} from 'shared/ReactFeatureFlags';
export type Flags = number;
export const NoFlags =  0b00000000000000000000000;
export const PerformedWork =  0b00000000000000000000001;
export const Placement =  0b00000000000000000000010;
export const Update =  0b00000000000000000000100;
export const PlacementAndUpdate =  Placement | Update;
export const Deletion =  0b00000000000000000001000;
export const ChildDeletion =  0b00000000000000000010000;
export const ContentReset =  0b00000000000000000100000;
export const Callback =  0b00000000000000001000000;
export const DidCapture =  0b00000000000000010000000;
export const Ref =  0b00000000000000100000000;
export const Snapshot =  0b00000000000001000000000;
export const Passive =  0b00000000000010000000000;
export const Hydrating =  0b00000000000100000000000;
export const HydratingAndUpdate =  Hydrating | Update;
export const Visibility =  0b00000000001000000000000;
export const LifecycleEffectMask = Passive | Update | Callback | Ref | Snapshot;
export const HostEffectMask =  0b00000000001111111111111;
export const Incomplete =  0b00000000010000000000000;
export const ShouldCapture =  0b00000000100000000000000;
export const ForceUpdateForLegacySuspense =  0b00000001000000000000000;
export const DidPropagateContext =  0b00000010000000000000000;