[lib] Move usePersistedStateLoaded() to lib package
Summary:
Related to: https://linear.app/comm/issue/ENG-9803/make-sure-peertopeermessagehandler-run-after-persisted-state-is-read
Web and native use similar mechanism for checking when state is read.
This diff unifies it and moves to lib package in order to use it later in PeerToPeerMessageHandler.
Test Plan: Run the app and web and make sure the app loads.
Reviewers: tomek, kamil, ashoat
Reviewed By: ashoat
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D13801