I did wonder why they didn't just say, have your silly little illegal referendum. Were they scared of the result? However they way they have gone about it, you have to wonder who is going to risk going out to vote to stay Spanish. Therefore it makes the independence vote more likely.
They were scared of the result. Yes, it is illegal - it is totally in breach of the 1978 constitution of which 90% of Catalans approved of.
But if the government had ignored it, they would have been seen by the Spanish people as allowing the constitution to be undermined which could have prompted other pro-independence groups in the Basque Country, Galicia etc. to follow suit.
And there would have been the small matter of a subsequent declaration of independence by the Catalans to deal with.
No doubt, Rajoy has made a complete mess of it but the more self-serving sections of the pro-independence groups have been almost longing for this to turn nasty as they feel it will help their cause. And they are certainly gaining a lot of sympathy from outside observers.