Fix issue in datatypes care graph computation involving subtyping (#8125)
The datatypes care graph was incorrectly computed for constructors taking `Real` arguments, due to subtyping.
This fixes the term index to cache on the *return* type for constructors, not the argument types. Caching based on argument types was incorrect even for non-parametric datatypes with arguments that have subtyping.
Fixes https://github.com/cvc5/cvc5/issues/8124.
This also does minor cleanup and additions done while debugging the issue.