Because readonly
, like private
, guards against Murphy, not Machiavelli*.
We use readonly
and private
and anything else that restricts what we can do, primarily because we have hopefully restricted more incorrect, inconsistent, or just plain stupid things, than we have useful and fruitful things.
But it's still just ones and zeros. If some memory is set to the number "42" and we access it through a readonly field, it wasn't readonly when the object was being created. There's nothing stopping it from being changed except the compiler spotting "hey, first you said you didn't want to change it, now you're trying to change it, what gives? One of those two decisions must be wrong".
Now, there's no promise that reflection will be able to change it, but there's no promise that it won't. Right now, the way reflection works and the way readonly works means that you can change it. At the very least, it would take a lot of work (perhaps with costs affecting us users as well as the team who needs to implement that work) to stop someone who'd presumably gone to the bother of doing this because they thought they had a good reason.
Note that the permissions relating to reflection do stop Machiavelli,
*Strictly, Murphy was talking about precisely how we should design things to stop people accidentally doing something disasterous - readonly
is a good example, plugs that can't physically be plugged in the wrong way around a better - and Machiavelli was teaching rather than practising the techniques. It makes for nowhere near as concise a saying though.