Does PostgreSQL take time to start streaming replication after restart master?
I want to make sure replication start as soon as server starts .


You can't. The server needs to start up, and it can only establish a streaming replication connection when it's up and ready.


  I want to know why this happens


Because there's no reason not to accept connections before streaming replication begins.

Among other things, if you're using WAL shipping instead of streaming replication, there might be no replication connection to wait for. Even if you're using streaming, you probably want the replica to keep on serving results if it loses its connection to the master.


  My thought was, when server started it will be ready to accept queries, and then after few seconds server start streaming replication. I though data will be lost in those few seconds.


It isn't.

The server is in recovery mode. Attempts to perform read/write queries will be rejected. This is the case whether or not there's a streaming replication connection.

After all, a server in hot standby mode that uses only a restore_command (no streaming replication) also rejects read/write queries.

You don't need to take any special action.

(In future, please try to include the background, the underlying problem, in your questions, so there's less guesswork and back and forth).