You are right. The fact that we can decide whether a string properly encodes a TM is crucial for many of our proofs

and exercises in the course. It is often only implicit, and we should be aware of that.

Actually, this task (of telling whether <M> is a legal encoding) is relatively easy (in terms of TM computations) and surely is in R.

Proving it formally is a bit tedious, but think of any reasonable encoding for Q,Σ,Γ,δ and the accepting/rejecting states. For this encoding, if it is more convenient, you

can use a non-binary (but constant-sized) alphabet and then say why it does not matter. Once you choose the encoding, and you are given an arbitrary string,

think of first "partitioning" it to the TM components, and check that they fit each other. For example, that δ is indeed defined over the correct domain.

Surely you can do all those checkings in finite amount of steps and decide accordingly.