text: Title: cache_data and cache_resource not working with DuckDB on Motherduck connection
  Body: ### Checklist
  
  - [x] I have searched the [existing issues](https://github.com/streamlit/streamlit/issues) for similar issues.
  - [x] I added a very descriptive title to this issue.
  - [x] I have provided sufficient information below to help reproduce this issue.
  
  ### Summary
  
  I have this connections script that connects to DuckDB on Motherduck:
  ```python
  import streamlit as st
  import duckdb
  from duckdb import DuckDBPyConnection
  import polars as pl
  import toml
  
  @st.cache_resource
  def motherduck_connection() -> DuckDBPyConnection:
      with open("./secrets.toml", "r") as f:
          secrets = toml.load(f)
  
      motherduck_token = secrets["tokens"]["motherduck"]
  
      conn = duckdb.connect(f"md:nba_data?motherduck_token={motherduck_token}")
  
      return conn
  
  @st.cache_data(ttl=600)
  def standings_table_connection(conn: DuckDBPyConnection) -> pl.DataFrame:
      standings_dataframe = pl.from_arrow(
          conn.sql("SELECT * FROM nba_data_staging.teams")
      )
  
      return standings_dataframe
  ```
  
  when running the streamlit app:
  ```python
  import streamlit as st
  
  from streamlit_components.standings_section import StandingsSection
  
  from streamlit_components.connections import (
      motherduck_connection,
      standings_table_connection
  )
  
  conn = motherduck_connection()
  
  standings_table = standings_table_connection(conn)
  
  st.set_page_config(page_title="Streamlit: Premier League", layout="wide")
  
  def app():
      standings_section = StandingsSection(standings_table)
  
      standings_section.display()
  
  if __name__ == "__main__":
      app()
  ```
  
  Python unexpectedly quits with the error:
  ```bash
  libc++abi: terminating due to uncaught exception of type std::runtime_error: instance allocation failed: new instance has no pybind11-registered base types
  Abort trap: 6
  ```
  
  when I remove the caching, it works.
  
  ### Reproducible Code Example
  
  ```Python
  
  ```
  
  ### Steps To Reproduce
  
  _No response_
  
  ### Expected Behavior
  
  _No response_
  
  ### Current Behavior
  
  Error message:
  ```bash
  libc++abi: terminating due to uncaught exception of type std::runtime_error: instance allocation failed: new instance has no pybind11-registered base types
  Abort trap: 6
  ```
  
  ### Is this a regression?
  
  - [ ] Yes, this used to work in a previous version.
  
  ### Debug info
  
  - Streamlit version: `1.42.0`
  - duckdb                   `1.2.0`
  - polars                     `1.22.0`
  - pyarrow                   `19.0.0`
  - Python version: `3.12.2`
  - Operating System: macOS - M3 chip
  - Browser: Firefox
  
  
  ### Additional Information
  
  _No response_