I have not come across any reference that has the quote you provided in your question by Imam Al-Shafi'i. Nonetheless, Ibn Hajar al-Haytami, a major figure in the Shafi'i school of jurisprudence, said in Al-Fatawa Al-Fiqhiyya Al-Kubra, Vol. 3, pp. 34-35:
والسنة في حق الرجل أن يستر جميع بدنه على الوجه المشروع فيه فهو مطلوب بذلك . لأجل الامتثال ثم العمامة على صفتها في السنة والرداء في الصلاة مطلوب شرعا وهو أن يجعله على كتفيه دون أن يغطى به رأسه
— NOTE: My own translation, so treat with care:
The Sunnah is for a man to conceal all parts of his body in the manner prescribed [by the Prophet ﷺ]. In order to comply, the turban [should be used] as described in the Sunnah, and the robe in the prayers are required, and this is to keep it on his shoulder, without covering his head with it [the robe].
This is as far as I could find on the matter from a Shafi'i perspective.
As for what 'Umar said about the topic, there is nothing that I could find either. However, there is an athar (Arabic: أثر) through his son, 'Abdullah ibn 'Umar, though, that was quoted in Al-Sharh Al-Momti' 'Ala Zad Al-Mustaqni' (Arabic: الشرح الممتع على زاد المستقنع), Vol. 2, pp. 137 by Muhammad ibn al Uthaymeen (Arabic: محمد بن صالح العثيمين):
وظاهر كلام المؤلف: أن ستر الرأس ليس بسنة؛ لأنه قال: صلاته في ثوبين» إزار ورداء، قميص ورداء، وما أشبه ذلك، فظاهره أنه لا يشرع ستر الرأس، وقد سبق في أثر ابن عمر أنه قال لمولاه نافع: أتخرج إلى الناس حاسر الرأس؟ قال: لا، قال: فالله أحق أن يستحى منه» وهو يدل على أن الأفضل ستر الرأس، ولكن إذا طبقنا هذه المسألة على قوله تعالى: «يا بني آدم خذوا زينتكم عند كل مسجد» (الأعراف الآية ٣١) تبين لنا أن ستر الرأس أفضل في قوم يعتبر ستر الرأس عندهم من أخذ الزينة، أما إذا كنا في قوم لا يعتبر ذلك من أخذ الزينة، فإنا لا نقول: إن ستره أفضل، ولا إن كشفه أفضل
— NOTE: My own translation, so treat with care:
And it appears from what the author said is that covering the head is not a sunnah, because he said: "His prayer in two garments: a short and a robe", or similar garments. It appears that covering the head is not prescribed as mandatory. It was narrated in an athar of Ibn 'Umar that he said to servant, Nafie': "Would you go out in front of the people with your head uncovered?" He said: "No." Ibn 'Umar said: "So Allah is more worthy to to be ashamed of." This indicates that it is better to cover the head, But if we apply this issue to the verse "O sons of Adam, take your adornment at every masjid" (Al-A'raf 31), it becomes clear that the head covering is better among people who consider it as part of adornment, and not to cover the head if among people who do not consider it an adornment. We do not say that covering is better, or uncovering is better.
Based on the above, it appears that there is no evidence that Imam Al-Shafi'i said the quote you mentioned, and that covering the head for males during prayers is a matter of what is considered part of adornment in the place one is in (contextual). The athar through Ibn 'Umar shows that covering the head is preferred, but this was not attributed to the Prophet ﷺ as a hadith. Yet the athar definitely shows that it is mubah to do so.