This is a slightly modified version of the second commit of #31132, which can be merged as an independent change. It has a small benefit on its own, but will help in moving the parent PR forward.
Introduce CoinsViewCacheNonMutating, a CCoinsViewCache subclass that reads coins without mutating the underlying cache via FetchCoin().
Add FetchCoinWithoutMutating() which walks up the cache hierarchy using only find() operations, then falls back to the base view’s GetCoin(). This prevents the main cache from caching inputs pulled from disk for a block that has not yet been fully validated. Once Flush() is called on m_connect_block_view, these inputs will be added as spent to coinsCache in the main cache via BatchWrite().
This is the foundation for async input fetching, where worker threads must not mutate shared state.