Red triangle with exclamation mark on boot, but reboots after second try. How to solve? I tried to flash stock recovery to my HTC One M7 phone (rooted, HAD TWRP recovery, s-on).

After my attempt, now phone restarts, and is stuck on the black screen with red triangle and exclamation mark in it. By pressing and holding power button, I restarted the phone. It restarted normally, and booted just fine. 

Now when I restart, the whole thing repeats. First it is stuck on the triangle screen then I restart it again and it boots up normally. 

The triangle indicates missing recovery right, so how does it start after second attempt? 

How can I fix it?
That's normal. The HTC stock recovery behaves like that. It is different from a custom recovery, you can't do anything with it. The stock recovery does only install the OTAs you receive officially. No need to worry about it.