Improve performance of _register_theme_block_patterns() function
The _register_theme_block_patterns() function previously introduced a substantial resource overhead issue, especially noticeable when themes, such as Twenty Twenty Four, registered a large number of block patterns. This overhead was mainly due to the extensive file operations required by the function, including file system checks and file reads.