Similar to what is done in #32411.
This is part of Meta-ticket #29705 (modularization) - to remove unnecessary dependencies on the distribution sagemath-symbolics (#31695)
CC: @egourgoulhon @mjungmath @fchapoton
Component: refactoring
Author: Matthias Koeppe
Branch/Commit: ac82dd2
Reviewer: Eric Gourgoulhon
Issue created by migration from https://trac.sagemath.org/ticket/32415