PolynomialRing appears to hang during construction

Hello. I came across a situation which hangs SageMath 9.4:

k = GF(4, 'a')
q = k.order()
n = 9

R = PolynomialRing(k, n, 'x', order="lex")
I = R.ideal([g^(q - 1) - 1 for g in R.gens()])
S = R.quotient(I, 'y')

print("The next statement seems to hang SageMath 9.4")
T = PolynomialRing(S, 'X')

If I change n to 3, then the statement executes almost immediately. With n = 9 the situation is reproduced consistently. The longest I waited is about 15m.

Am I doing something wrong here? If not, shall I create a defect on trac.sagemath.org?

UPDATE 29.11.2021

I traced the problem a bit further. It turns out that SageMath does not hang, but rather takes a long time to compute the primary decomposition of the ideal above. An even smaller example is as follows

k = GF(4, 'a')
q = k.order()
n = 9

R = PolynomialRing(k, n, 'x', order="lex")
I = R.ideal([g^(q - 1) - 1 for g in R.gens()])
D = I.complete_primary_decomposition()

Just keep in mind that the goal is not to compute the decomposition of this ideal but to have a polynomial ring that is always reduced. I'll create a separate question for this. Perhaps there's a better way to do it.

edit retag close merge delete