How to Replace the Default HTML of wp-login.php Page in WordPress Without Creating a Custom Login Page and Redirecting to It

I’m developing a WordPress plugin that aims to modify the HTML structure of the login page (wp-login.php), registration page (wp-login.php?action=register), and lost password page (wp-login.php?action=lostpassword).

My goal is NOT to create a custom login page and redirect to it. I want to directly replace the HTML of the default WordPress login pages with my own custom HTML, without relying on redirects.

I’ve tried using hooks like login_enqueue_scripts to inject CSS and JavaScript, but this doesn’t allow me to fully control the HTML structure.

Is there a way to achieve this?

I understand that directly modifying the HTML of core WordPress files is generally discouraged due to security and maintainability concerns. I’m open to any alternative solutions, even if they require a more complex approach.

I’m looking for any suggestions or pointers that might help me achieve this functionality.

Example:

Ideally, I’d like to replace the default WordPress login form with a custom form that has a different layout and additional fields.

Please note: I’m looking for solutions that do not involve creating custom login pages or redirecting users.

Any insights or code examples would be greatly appreciated.

Thank you!