I remember reading somewhere that sometimes in some stream ciphers it is necessary to skip the first values they produce.
Not some stream ciphers, but one specific cipher: RC4. RC4 is from an earlier era when cryptographic primitives did not receive a lot of scrutiny – in fact, it was originally a secret algorithm. Once the design of RC4 was made public, a number of weaknesses were discovered. The main weakness was that a bias in the beginning of the keystream. RC4 was popular at the time an attack based on this bias was first discovered, and a countermeasure was to discard the first few bytes. Over time, the bias analysis was improved, which made discards insufficient, and RC4 gradually lost in popularity.
RC4 has a very simple design: each round consists of some simple scrambling of the internal state, and emits one byte of output. It turns out that until there have been enough rounds, the output is somewhat predictable.
Most ciphers perform multiple rounds of scrambling before emitting any output. And ciphers in common use have been validated by years of study by the cryptographic research community.
Just as a hash function needs to do many rounds before it returns a random result, the CSPRNG needs some number of iterations so that seed and key information cannot be obtained from the first results.
Yes and no. It's true that a CSPRNG needs enough scrambling from the seed. But that scrambling is built into the basic constituents of the algorithm. Typical modern CSPRNG are based either on a hash (which already has many rounds inside) or on a block or stream cipher (which already has many rounds inside).
My idea to test how many iterations we have to skip is to treat the CSPRNG as a hash function with a key and feed it by numbers 1,2,3,... as a seed with some keys
This is a valid and popular approach for key derivation functions — deterministically generating pseudorandom material from a seed. (Note that I'm talking about key derivation from high-entropy material, not password-based key derivation, also known as key stretching, which has different requirements.) Examples of key derivation algorithms that follow this paradigm are NIST SP 800-108 KDF in counter mode and HKDF.
However, as a random generator, this approach is missing something — which RC4 is also missing, by the way (which made it a poor choice for a CSPRNG, despite its popularity). It lacks backtracking resistance: the property that if the state is compromised, this compromises future RNG outputs, but not past outputs. Backtracking resistance requires a one-way transformation of the RNG's state each time it emits output. Any construction that uses a constant secret and a public variable to generate outputs lacks backtracking resistance.