how to make RFID mfrc522 work just when serial is estblished

Serial.available() returns the number of bytes in the incoming serial data buffer that can be read().

It tells you nothing about whether there is anything on the other end of the serial port.

What you are asking for is impossible. A radio station broadcasts. The operators have no way of knowing whether anyone is listening. Unless they solicit input AND the listener(s) care to respond.

The Arduino sends data out the serial port, or not, without caring whether anyone is listening, or not.