Template binary_sensor always OFF on startup

There is some template "binary_sensor".
Let it be this simple example:

binary_sensor:
  - platform: ping
    host: google.com
    count: 2
    scan_interval: 60
    name: net_is_available_google

  - platform: ping
    host: ya.ru
    count: 2
    scan_interval: 60
    name: net_is_available_yandex

  - platform: template
    sensors:
      net_is_available_internet:
        value_template: "{{ is_state('binary_sensor.net_is_available_google','on') or
                            is_state('binary_sensor.net_is_available_yandex','on') }}"
        device_class: connectivity

I see in History that during startup this template sensor becomes OFF.
Here is just a small part of History for some binary_sensor's:
изображение
There were 4 restarts, and on every restart these sensors were OFF.

I tried to change the sensor’s definition:

        value_template: "{%  set GOOGLE = 'binary_sensor.net_is_available_google' -%}
                         {%- set YANDEX = 'binary_sensor.net_is_available_yandex' -%}
                         {%- if states(GOOGLE) in ['unavailable','unknown'] or
                                states(YANDEX) in ['unavailable','unknown'] -%}
                         {{ 'unavailable' }}
                         {%- else -%}
                         {{ is_state(GOOGLE,'on') or
                            is_state(YANDEX,'on') }}
                         {%- endif %}"

I expected to see a grey stripe on the History (for "unavailable") instead of red (for "off").
But this does not help.
Then I defined an "availability_template":

        availability_template: "{%  set GOOGLE = 'binary_sensor.net_is_available_google' -%}
                                {%- set YANDEX = 'binary_sensor.net_is_available_yandex' -%}
                                {{ not states(GOOGLE) in ['unavailable','unknown'] and
                                   not states(YANDEX) in ['unavailable','unknown'] }}"

Does not help too.

What can I do?
Is it possible to solve it?

Restarts of what? HA, the machine, … ?
Very likely, if those sensors are off, it just means that the internet was indeed not available at “startup”.

You might want to replace dns names by IPs (e.g. 8.8.8.8 for google) if you want to assess pure internet connectivity rather than a “functional” internet.

Restart of HA.
Internet sensor was just an example.
Same is with many template binary sensors.

One more example:
изображение

binary_sensor:
  - platform: template
    sensors:
      on_value:
        value_template: "{{ 'on' }}"

Any other ideas?

2022.2 - binary_sensor = unknown at HA startup.