Converting to object before then unstack works, whereas automatic upcast does not happen. Missing values are replaced with NaT instead of automatically upcasting to object and filling with the requested value.

In [44]: td = [Timedelta(days=i) for i in range(4)]
In [45]: data = Series(td)
In [46]: data.index = MultiIndex.from_tuples(
   ....:    [('x', 'a'), ('x', 'b'), ('y', 'b'), ('z', 'a')])
In [47]: data.unstack(fill_value='foo')
Out[47]:
       a      b
x 0 days 1 days
y    NaT 2 days
z 3 days    NaT
In [48]: data.astype(np.object_).unstack(fill_value='foo')
Out[48]:
                 a                b
x  0 days 00:00:00  1 days 00:00:00
y              foo  2 days 00:00:00
z  3 days 00:00:00              foo

Culprit is some outdated code in _maybe_promote.

Comment From: amcpherson

Follows from work done for #9746.

Comment From: jreback

thanks @amcpherson for the clear issue!

Comment From: jbrockmendel

It isn't clear to me that this should be supported.

Comment From: mroeschke

Yeah I would expect this to raise

Comment From: jbrockmendel

This case now raises on main

ser = pd.Series([pd.Timedelta(days=i) for i in range(4)])
ser.index = pd.MultiIndex.from_tuples([('x', 'a'), ('x', 'b'), ('y', 'b'), ('z', 'a')])

>>> ser.unstack(fill_value="foo")

  File "[...]/pandas/core/reshape/reshape.py", line 323, in get_new_values
    new_values = new_values.view("i8")
                 ^^^^^^^^^^^^^^^^^^^^^
  File "[...]/numpy/_core/_internal.py", line 564, in _view_is_safe
    raise TypeError("Cannot change data-type for array of references.")
TypeError: Cannot change data-type for array of references.

We don't have any test cases that check for fill_values that cause casting (except for "iub" dtypes)