### Godot version

v4.2.dev.custom_build [c3b0a92c3]

### System information

Debian Linux X11 Xfce

### Issue description

In the following scene tree it is not possible to write anything in `LineEditB`.
![image](https://github.com/godotengine/godot/assets/6299227/ce5f696a-d86a-402f-98f7-6a762f15543e)

I would expect, that it is possible to focus `LineEditB` with a mouse click and write into it.

Regression from #58334

### Steps to reproduce

1. Load and run MRP
2. Mouse Click into the left LineEditB
3. Type Keyboard => No letters appear in the LineEditB

Variant:

1. Load and run MRP
2. Mouse Click into the right LineEditA
3. Mouse Click into the left LineEditB
4. Type Keyboard => Letters appear in LineEditA instead of LineEditB


### Minimal reproduction project

[BugKeyInputRouting.zip](https://github.com/godotengine/godot/files/11994804/BugKeyInputRouting.zip)

RS::get_singleton()->canvas_item_clear(sw.canvas_item);
	Rect2i r = Rect2i(p_window->get_position(), sw.window->get_size());
	if (!p_window->get_flag(Window::FLAG_BORDERLESS)) {
		Ref<StyleBox> panel = p_window->get_theme_stylebox(gui.subwindow_focused == p_window ? SNAME("embedded_border") : SNAME("embedded_unfocused_border"));
		panel->draw(sw.canvas_item, r);
		
		Ref<Font> title_font = p_window->get_theme_font(SNAME("title_font"));
		int font_size = p_window->get_theme_font_size(SNAME("title_font_size"));
		Color title_color = p_window->get_theme_color(SNAME("title_color"));
		int title_height = p_window->get_theme_constant(SNAME("title_height"));
		int close_h_ofs = p_window->get_theme_constant(SNAME("close_h_offset"));
		int close_v_ofs = p_window->get_theme_constant(SNAME("close_v_offset"));
		TextLine title_text = TextLine(p_window->atr(p_window->get_title()), title_font, font_size);
		title_text.set_width(r.size.width - panel->get_minimum_size().x - close_h_ofs);
		title_text.set_direction(p_window->is_layout_rtl() ? TextServer::DIRECTION_RTL : TextServer::DIRECTION_LTR);
		int x = (r.size.width - title_text.get_size().x) / 2;
		int y = (-title_height - title_text.get_size().y) / 2;
		Color font_outline_color = p_window->get_theme_color(SNAME("title_outline_modulate"));
		int outline_size = p_window->get_theme_constant(SNAME("title_outline_size"));
		if (outline_size > 0 && font_outline_color.a > 0) {
			title_text.draw_outline(sw.canvas_item, r.position + Point2(x, y), outline_size, font_outline_color);
		}
		title_text.draw(sw.canvas_item, r.position + Point2(x, y), title_color);
		bool pressed = gui.subwindow_focused == sw.window && gui.subwindow_drag == SUB_WINDOW_DRAG_CLOSE && gui.subwindow_drag_close_inside;
		Ref<Texture2D> close_icon = p_window->get_theme_icon(pressed ? "close_pressed" : "close");
		close_icon->draw(sw.canvas_item, r.position + Vector2(r.size.width - close_h_ofs, -close_v_ofs));
	}
	RS::get_singleton()->canvas_item_add_texture_rect(sw.canvas_item, r, sw.window->get_texture()->get_rid());
}
void Viewport::_sub_window_grab_focus(Window *p_window) {