Redefine block environment in beamer

I'm trying to redefine the block environment in beamer so that the itemize/enumerate bullets follow the color of block title instead of structure:

\documentclass{beamer}

\renewenvironment<>{block}[1]{%
\begin{actionenv}#2%
\def\insertblocktitle{#1}%
\par%
\mode<presentation>{%
\setbeamercolor{local structure}{use=block title,%
fg=block title.bg}}%
\usebeamertemplate{block begin}}
{\par%
\usebeamertemplate{block end}%
\end{actionenv}}

But this immediately throws the error

ERROR: LaTeX Error: Command \beamerx@\block already defined.

This seems very similar to the problem discussed at: How to redefine the \emph command in Beamer?

The aforementioned thread culminated in the discovery of a bug in beamer which was patched 4 years ago, and I'm wondering if this might be a similar bug in beamer's renewenvironment.

Yes, this seems to be also a similar bug with \newenvironment in beamer. The problem is the same mentioned by Loop Space in his answer to How to redefine the \emph command in Beamer?. The problem seems to be the same mentioned in the linked answer and the "solution" is similar.


\documentclass{beamer}

% Fix'' for possible bug
\makeatletter
\long\def\beamer@newenvnoopt#1#2#3#4{%
\expandafter\renewcommand\expandafter<\expandafter>\csname#1\endcsname[#2]{#3}%<- here
\expandafter\long\expandafter\def\csname end#1\endcsname{#4}%
}
\long\def\beamer@newenvopt#1#2[#3]#4#5{%
\expandafter\renewcommand\expandafter<\expandafter>\csname#1\endcsname[#2][#3]{#4}%<- here
\expandafter\long\expandafter\def\csname end#1\endcsname{#5}%
}
\makeatother

\renewenvironment<>{block}[1]{%
\begin{actionenv}#2%
\def\insertblocktitle{#1}%
\par%
\mode<presentation>{%
\setbeamercolor{local structure}{use=block title,%
fg=block title.bg}}%
\usebeamertemplate{block begin}}
{\par%
\usebeamertemplate{block end}%
\end{actionenv}}

\begin{document}

\begin{frame}
\begin{block}{A test new block}
test
\end{block}
\end{frame}

\end{document}