It is safe to xor parameters into the sponge as long as they are uniquely encoded so that they can't be confused with part of a message. The same goes for padding: if two distinct messages are treated the same way because you skipped padding, you're in trouble; e.g., if you use a length prefix then no padding at the end is necessary but you need to know the length up front.
This is not like JWT where the adversary can change one part of the JSON like the algorithm tag to control what algorithm the receiver uses to verify the rest of the JSON: you can't recover parameters from a hash anyway if it's worth its salt as a hash, so legitimate users aren't even temped to do that.
Even better, hashing the parameters means that an adversary can't reuse a hash made with one set of parameters for an application that uses another set of parameters—hashing the parameters makes the hashes used by the two applications essentially independent.
As a pathological example of how this could go wrong, imagine a protocol where one part uses $\operatorname{SHA-256}(x)$ as a public identifier for something, and another part uses $\operatorname{SHA-256}(\operatorname{SHA-256}(x))$ as a secret, each of which use is independently essentially fine (except for potential generic issues with $H^2$). Obviously this combination of uses could be exploited to learn the secret. Were the number of iterations of SHA-256 hashed into the message, as in $\operatorname{SHA-256}(1 \mathbin\| x)$ and $\operatorname{SHA-256}(2 \mathbin\| \operatorname{SHA-256}(2 \mathbin\| x))$ instead, there would be no such danger.