diff --git a/src/_pytest/cacheprovider.py b/src/_pytest/cacheprovider.py
index 78edf9ac5..681d02b40 100755
--- a/src/_pytest/cacheprovider.py
+++ b/src/_pytest/cacheprovider.py
@@ -20,8 +20,6 @@ from .reports import CollectReport
 from _pytest import nodes
 from _pytest._io import TerminalWriter
 from _pytest.compat import final
-from _pytest.compat import LEGACY_PATH
-from _pytest.compat import legacy_path
 from _pytest.config import Config
 from _pytest.config import ExitCode
 from _pytest.config import hookimpl
@@ -142,13 +140,6 @@ class Cache:
         res.mkdir(exist_ok=True, parents=True)
         return res
 
-    def makedir(self, name: str) -> LEGACY_PATH:
-        """Return a directory path object with the given name.
-
-        Same as :func:`mkdir`, but returns a legacy py path instance.
-        """
-        return legacy_path(self.mkdir(name))
-
     def _getvaluepath(self, key: str) -> Path:
         return self._cachedir.joinpath(self._CACHE_PREFIX_VALUES, Path(key))
 
diff --git a/src/_pytest/legacypath.py b/src/_pytest/legacypath.py
index e8a239cf2..d53a0d315 100644
--- a/src/_pytest/legacypath.py
+++ b/src/_pytest/legacypath.py
@@ -307,6 +307,14 @@ def tmpdir(tmp_path: Path) -> LEGACY_PATH:
     return legacy_path(tmp_path)
 
 
+def Cache_makedir(self: pytest.Cache, name: str) -> LEGACY_PATH:
+    """Return a directory path object with the given name.
+
+    Same as :func:`mkdir`, but returns a legacy py path instance.
+    """
+    return legacy_path(self.mkdir(name))
+
+
 def pytest_configure(config: pytest.Config) -> None:
     mp = pytest.MonkeyPatch()
     config.add_cleanup(mp.undo)
@@ -324,3 +332,6 @@ def pytest_configure(config: pytest.Config) -> None:
     else:
         _tmpdirhandler = TempdirFactory(tmp_path_factory, _ispytest=True)
         mp.setattr(config, "_tmpdirhandler", _tmpdirhandler, raising=False)
+
+    # Add Cache.makedir().
+    mp.setattr(pytest.Cache, "makedir", Cache_makedir, raising=False)
diff --git a/testing/test_legacypath.py b/testing/test_legacypath.py
index 89c4fa862..04cd61f0e 100644
--- a/testing/test_legacypath.py
+++ b/testing/test_legacypath.py
@@ -67,3 +67,9 @@ def test_tmpdir_always_is_realpath(pytester: pytest.Pytester) -> None:
     )
     result = pytester.runpytest("-s", p, "--basetemp=%s/bt" % linktemp)
     assert not result.ret
+
+
+def test_cache_makedir(cache: pytest.Cache) -> None:
+    dir = cache.makedir("foo")  # type: ignore[attr-defined]
+    assert dir.exists()
+    dir.remove()