I think you are at least partly right.
Without the restrictive relative, it is fine:
Walking is my habit.
With a non-restrictive relative, it is also fine:
Walking, which I do every day, is my habit.
(That is perhaps tautologous, as "which I do every day" is almost a definition of "habit"; but that doesn't alter the fact that it is grammatical.
But with a restrictive relative clause, it is certainly awkward. I don't think it is ungrammatical: I can imagine it in rather stilted, formal language, eg:
Talking that is not necessary should be avoided.
[Note incidentally that other modifiers which are not relative clauses can come there:
Walking in the hills restores my good humour.
Driving without care and attention is dangerous.
I believe that these work because the modifier goes inside the gerund clause:
[Driving [without care and attention]]NP is dangerous.
But I haven't explored this point any further.]